Does the documentation ( or anyone) talks about the dpi values of the default
android:textAppearance="?android:attr/textAppearanceLarge"
}android:textAppearance="?android:attr/textAppearanceMedium"
}android:textAppearance="?android:attr/textAppearanceSmall"
}widgets in the SDK ?
To put it in another way, can we replicate the appearance of these text views without using the android:textAppearance
attribute?
This question is related to
android
textview
android-xml
To put it in another way, can we replicate the appearance of these text views without using the android:textAppearance attribute?
Like biegleux already said:
If you want to use the small, medium or large value on any text in your Android app, you can just create a dimens.xml
file in your values
folder and define the text size there with the following 3 lines:
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">18sp</dimen>
<dimen name="text_size_large">22sp</dimen>
Here is an example for a TextView with large text from the dimens.xml
file:
<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"/>
Programmatically, you could use:
textView.setTextAppearance(android.R.style.TextAppearance_Large);
Source: Stackoverflow.com