如何设置包含在Android的背景颜色如何设置、颜色、背景、Android

2023-09-05 03:51:03 作者:时光挺欠揍

如何在一个包括在Android的标签设置背景颜色?这不能正常工作:

 <包括
 机器人:ID =@ + ID / list_item_section_text
 机器人:layout_width =FILL_PARENT
 机器人:layout_height =match_parent
 布局=@安卓布局/ preference_category
 机器人:背景=%MY_BACKGROUND%/>
 

解决方案   

您能不能给一个背景色为包括标记。

为什么?

其明显的,如果你能能够给背景颜色为包括标记那么这将是所有搞砸了你的包括颜色和可能被应用到布局其中已经包含了另一种颜色。

改变Android按钮背景颜色的高效方法

How to set background color on an include tag in Android? This does not work:

 <include
 android:id="@+id/list_item_section_text"
 android:layout_width="fill_parent"
 android:layout_height="match_parent"
 layout="@android:layout/preference_category"
 android:background="%MY_BACKGROUND%"/>

解决方案

You can not give a background color into include tag.

Why ?

Its obvious , if you could able to give the background color to include tag then it would be all messed up with your include color and another color which might be applied to that layout which has already included .