Search code examples
androidtextstylesappearance

Android: how to see all TextAppearance styles


I'm trying to style my login form, however I am having trouble getting the background of the inputs to be white.

@android:style/TextAppearance.DeviceDefault.Inverse works, as it displays the color white for the input title; however, for the hint text it's still black.

Is there a way to let me see all kinds of text appearance styles at once, instead of trying each style one by one? I notice there is a very long list of defined styles, but I cannot view them all together to compare.

<android.support.design.widget.TextInputLayout
                 android:id="@+id/textinputlayout"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="15dp"
                 android:layout_marginRight="15dp"
                 android:layout_marginTop="40dp"
                 app:hintTextAppearance="@android:style/TextAppearance.DeviceDefault.Inverse">

                 <android.support.design.widget.TextInputEditText
                     android:id="@+id/nameEdit"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="User Name" />

</android.support.design.widget.TextInputLayout>

Solution

  • You can do like this.

    change TextInputLayout's LEFT-TOP text color

    app:hintTextAppearance="@style/text_in_layout_hint_Style"
    

    style code

    <style name="text_in_layout_hint_Style">
        <item name="android:textColor">#FF0000</item>
    </style>
    

    You can do this in .java.

    textInputLayout.setHintTextAppearance(R.style.text_in_layout_hint_Style);