我正在使用 android 设计库的 TextinputLayout
。但无法自定义 EditText
内的 TextinputLayout
的提示颜色、标签颜色和下划线颜色。请帮忙。
原文由 Nitesh Verma 发布,翻译遵循 CC BY-SA 4.0 许可协议
我正在使用 android 设计库的 TextinputLayout
。但无法自定义 EditText
内的 TextinputLayout
的提示颜色、标签颜色和下划线颜色。请帮忙。
原文由 Nitesh Verma 发布,翻译遵循 CC BY-SA 4.0 许可协议
XML
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/activity_profile_textInputLayout_mobile"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:hint="Mobile Number"
app:theme="@style/EditBoxColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/activity_profile_textInputEditText_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="10"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
风格
<style name="EditBoxColor" parent="ShapeAppearance.MaterialComponents.SmallComponent">
<item name="colorPrimary">@color/colorPurple</item>
<item name="colorPrimaryDark">@color/colorPurple3</item>
</style>
原文由 Ashwin H 发布,翻译遵循 CC BY-SA 4.0 许可协议
2 回答1.3k 阅读✓ 已解决
2 回答2.6k 阅读
2 回答1.7k 阅读
1 回答2.1k 阅读
1 回答1.1k 阅读
1 回答1.3k 阅读
1.3k 阅读
更改底线颜色:
有关更多信息,请查看 此线程。
浮动时更改提示颜色
并像这样使用它:
当它不是浮动标签时更改提示颜色:
_感谢 @AlbAtNf_