Change EditText hint color when using TextInputLayout
Looks like the parent view had a style for a 3rd party library that was causing the EditText to be white.
android:theme="@style/com_mixpanel_android_SurveyActivityTheme"
Once I removed this everything worked fine.
How to change the TextInputEditText floating hint color when not focused
Add this code into your style.xml file ->
<style name="TextLabelDummy" parent="Widget.MaterialComponents.TextInputLayout.FilledBox.Dense">
<item name="colorAccent">@color/black</item> // Text Color
<item name="android:textColorHint">@color/blue</item> // Hint Color
<item name="colorControlActivated">@color/white</item> //Floating label color
</style>
You can change the parent attribute whatever you want. I've randomly used the "Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"
Then call this as theme into you layout file
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayoutNumberDummy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginBottom="32dp"
android:theme="@style/TextLabelDummy">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/textInputEditTextNumberDummy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/text_mobile" />
</com.google.android.material.textfield.TextInputLayout>
It worked fine on my side. Just check it and let me know about it. Thank you.
Related Topics
How to Programmatically Set the Background Color Gradient on a Custom Title Bar
Cardview Layout_Width="Match_Parent" Does Not Match Parent Recyclerview Width
How to Get Android Device Screen Size
How to Set the Divider Between Tabs in Tablayout of Design Support Library
Centering Recyclerview Items with Flexboxlayoutmanager
How to Use Ms Visual Studio for Android Development
How to Receive Serial Data Using Android Bluetooth
Android:Actionbarstyle Requires API Level 11
How to Add Button Tint Programmatically
What Is the Use of the Res/Values/Public.Xml File on Android
Is Secure.Android_Id Unique for Each Device
Proguard: Can't Find Referenced Class Com.Google.Android.Gms.R
Login Failed Invalid Key Error with Facebook Sdk