Я не знаю, является ли это ответом на ваш вопрос, но вы можете попробовать установить цвет фона в xml-макете следующим образом.Это просто, это всегда работает
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="0xfff00000"
>
<TextView
android:id="@+id/text_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
Вы также можете делать более причудливые вещи с фонами, создав XML-фоновый файл с градиентами, которые являются классными и полупрозрачными, и обратитесь к нему для другого использования, см. Пример ниже:
макет background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="90"
android:startColor="#f0000000"
android:endColor="#ff444444"
android:type="linear" />
</shape>
</item>
</selector>
ваш макет
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@layout/background"
>
<TextView
android:id="@+id/text_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>