如何设置包含在Android的背景颜色 [英] How to set include background color in android

查看:280
本文介绍了如何设置包含在Android的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

解决方案
  

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

为什么?

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

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 .

这篇关于如何设置包含在Android的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆