Android Textallcaps In Theme
Solution 1:
By using AppCompattextAllCaps
in Android Apps supporting older API's (less than 14)
A work around for this would to explicitly set the style like this:
<android.support.v7.internal.widget.CompatTextView
style="@style/MyTextViewStyle"
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:textAllCaps="true"/>
or alternatively use a new style that inherits textViewStyle and adds the textAllCaps attribute along with any other styles of your choosing:
<stylename="MyCompatTextViewStyle"parent="MyTextViewStyle"><itemname="textAllCaps">true</item></style>
In layout:
<android.support.v7.internal.widget.CompatTextView
style="@style/MyCompatTextViewStyle"
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Note:
1> this widget won't inherit any default styles that are set in your theme via android:textViewStyle
2>Using this widget seems to be internal given the package name meaning it's not really intended for public API. It's also not "fully baked" in that the textAllCaps
attribute needs to be directly on the style/view and can not be in the textAppearance style for it to work.
Solution 2:
Try with both textAllCaps
and android:textAllCaps
.
<stylename="TextViewStyle"><itemname="textAllCaps">true</item><itemname="android:textAllCaps">true</item></style>
But I think it's working just with design library 23.2.0 or later.
Post a Comment for "Android Textallcaps In Theme"