반응형
기본 "큰", "중간"및 "작은"텍스트보기의 dpi 값 android
문서 (또는 다른 사람)가 기본값의 dpi 값에 대해 이야기합니까?
- 큰 TextView {
android:textAppearance="?android:attr/textAppearanceLarge"
} - 중간 텍스트 뷰 {
android:textAppearance="?android:attr/textAppearanceMedium"
} - 작은 TextView {
android:textAppearance="?android:attr/textAppearanceSmall"
}
SDK의 위젯?
다시 말하면, android:textAppearance
속성 을 사용하지 않고 이러한 텍스트 뷰의 모양을 복제 할 수 있습니까?
android sdk 디렉토리를 참조하십시오.
에서 \platforms\android-X\data\res\values\themes.xml
:
<item name="textAppearanceLarge">@android:style/TextAppearance.Large</item>
<item name="textAppearanceMedium">@android:style/TextAppearance.Medium</item>
<item name="textAppearanceSmall">@android:style/TextAppearance.Small</item>
에서 \platforms\android-X\data\res\values\styles.xml
:
<style name="TextAppearance.Large">
<item name="android:textSize">22sp</item>
</style>
<style name="TextAppearance.Medium">
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.Small">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?textColorSecondary</item>
</style>
TextAppearance.Large
스타일이 스타일에서 상속됨을 의미하므로 스타일의 TextAppearance
전체 정의를 보려면 스타일을 추적해야합니다.
링크 : http://developer.android.com/design/style/typography.html
다른 방법으로, android : textAppearance 속성을 사용하지 않고 이러한 텍스트 뷰의 모양을 복제 할 수 있습니까?
biegleux 처럼 이미 말했다 :
- 작은 14sp를 나타냅니다
- 중간 은 18sp를 나타냅니다
- 큰 22sp를 나타냅니다
Android 앱의 텍스트에 작은 값 , 중간 값 또는 큰 값 을 사용하려면 폴더에 dimens.xml
파일을 만들고 values
텍스트 크기를 다음 3 줄로 정의하면됩니다.
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">18sp</dimen>
<dimen name="text_size_large">22sp</dimen>
다음은 파일 에서 큰 텍스트가 있는 TextView의 예입니다 dimens.xml
.
<TextView
android:id="@+id/hello_world"
android:text="hello world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_large"/>
프로그래밍 방식으로 다음을 사용할 수 있습니다.
textView.setTextAppearance(android.R.style.TextAppearance_Large);
반응형
'IT' 카테고리의 다른 글
다이제스트와 기본 인증의 차이점은 무엇입니까? (0) | 2020.05.26 |
---|---|
AccessViolationException을 처리하는 방법 (0) | 2020.05.26 |
git-worktree를 무엇에 사용합니까? (0) | 2020.05.26 |
Django : 일부 모델 필드가 서로 충돌하는 이유는 무엇입니까? (0) | 2020.05.26 |
연결할 호스트가 없습니다! (0) | 2020.05.25 |