[android] dpi value of default "large", "medium" and "small" text views android

Does the documentation ( or anyone) talks about the dpi values of the default

  • Large TextView {android:textAppearance="?android:attr/textAppearanceLarge"}
  • Medium TextView {android:textAppearance="?android:attr/textAppearanceMedium"}
  • Small TextView { android:textAppearance="?android:attr/textAppearanceSmall"}

widgets in the SDK ?

The Large, medium, small and regular text views

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

The answer is


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:

  • small represents 14sp
  • medium represents 18sp
  • large represents 22sp

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);

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to textview

Kotlin: How to get and set a text to TextView in Android using Kotlin? How to set a ripple effect on textview or imageview on Android? The specified child already has a parent. You must call removeView() on the child's parent first (Android) Android: Creating a Circular TextView? android on Text Change Listener Android - Set text to TextView Placing a textview on top of imageview in android Rounded corner for textview in android Different font size of strings in the same TextView Auto-fit TextView for Android

Examples related to android-xml

Add a background image to shape in XML Android Custom designing EditText How can I draw circle through XML Drawable - Android? dpi value of default "large", "medium" and "small" text views android Android : difference between invisible and gone? error: Error parsing XML: not well-formed (invalid token) ...? Difference between "@id/" and "@+id/" in Android How can you get the Manifest Version number from the App's (Layout) XML variables? Android button with different background colors Vertical line using XML drawable