【发布时间】:2014-10-01 23:47:56
【问题描述】:
在我的应用程序中,所有背景设置为 @background="@android:color/white" 的视图都可以在除三星 Galaxy S3 mini 之外的所有设备上正确显示。在这种情况下,所有这些视图都设置了灰色背景。
在这种特定情况下,包含复选框的 LinearLayout 的背景应该是白色的:
<LinearLayout
android:id="@+id/ll_child1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="10dp"
android:orientation="vertical" >
...
</LinearLayout>
我尝试用android:background="#FFFFFF" 替换android:background="@android:color/white",但唯一可行的解决方案是在我的drawable 目录中创建一个white_bg.xml:
<item android:bottom="0px">
<shape android:shape="rectangle" >
<solid android:color="@android:color/white" />
</shape>
</item>
并将背景设置更改为android:background="@drawable/white_bg"。
认为这解决了我的问题,但更改我的应用程序中的所有布局非常烦人,尤其是因为这个问题似乎只影响少数设备。我想知道是否有更优雅的解决方案。
【问题讨论】:
标签: android layout colors background