Kru*_*hal 5 android android-appcompat material-design
我在这里看到了新的appCompat控件.并在Android应用程序中实现它,但我没有找到任何特定的方式来自定义其颜色.
就像我们在样式中设置强调色一样,编辑文本会自动捕获它.但它在AppCompatButton的情况下不起作用.
有没有人发现这件事?
Dav*_*man 10
请参阅此处:带有Material Design和AppCompat的Android中的着色按钮
总而言之,您可以使用tintBackground按钮本身上的属性,也可以使用colorControlNormal(或组合).
此外,您可以使用Button它AppCompatButton,只要您正在使用主题并从AppCompatActivity正确继承,它就会转换为.
链接的URL中的示例
theme.xml:
<item name="colorButtonNormal">@color/button_color</item>
V21/theme.xml
<item name="android:colorButtonNormal">@color/button_color</item>
要么
<Button
android:id="@+id/add_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/bg_remove_btn_default"
android:textColor="@android:color/white"
tools:text="Remove" />
Run Code Online (Sandbox Code Playgroud)
像这样使用SupportCompib和AppCompatButton:
<android.support.v7.widget.AppCompatButton
android:id="@+id/add_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:backgroundTint="@color/bg_remove_btn_default"
android:textColor="@android:color/white"
tools:text="Remove" />
Run Code Online (Sandbox Code Playgroud)
应用程序是一个mxlns:xmlns:app ="http://schemas.android.com/apk/res-auto"
所以backgroundTint也适用于preLollipop