英文:
Android: Change hint text color for a material exposed outlined drop-down when unfocused
问题
我正在尝试更改material exposed dropdown
在未选中或失去焦点时的提示文字颜色。我无法找到确切的方法来实现这个目标。除了这个之外,我已经成功地按照自己的喜好更改了几乎所有内容。是否有人可以帮助我解决这个问题?
英文:
I am trying to change the hint color of a material exposed dropdown
when its not selected or unfocused. I am unable to find the exact method that can do this. I have been able to change pretty much everything according to my liking except that. Can somebody help me with this?
答案1
得分: 0
你可以使用 android:textColorHint
属性:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:textColorHint="@color/text_input_hint_selector"
...>
使用以下选择器:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.38" android:color="@color/...." android:state_enabled="false"/>
<item android:alpha="0.6" android:color="@color/...."/>
</selector>
英文:
You can use the android:textColorHint
attribute:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:textColorHint="@color/text_input_hint_selector"
...>
with this selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.38" android:color="@color/...." android:state_enabled="false"/>
<item android:alpha="0.6" android:color="@color/...."/>
</selector>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论