【发布时间】:2021-04-05 05:00:11
【问题描述】:
- Android Stidio 4.1.1
- SDK 29 (Android 10)
我试图更改 xml 上的按钮背景颜色,但它没有改变。
这是我的代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff0000"/>
</LinearLayout>
我认为它可能工作正常,但它仍然是紫色:(
【问题讨论】:
-
构建后会改变应用程序的颜色吗?
-
@ZankrutParmar 不,它还是紫色
-
这可能会有所帮助。 stackoverflow.com/a/50884131/8227346
-
您在编辑器中应用了一个名为“测试”的自定义主题。该主题的父主题是什么?
-
这能回答你的问题吗? Having an issue coloring custome xml button
标签: android xml android-layout