Adding PNG and color to background
I have LinearLayout, and I have png that I used as tiles - but i want also that the color behind it will be white.
Is that possible?
My code is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/LinearMain" android:background="@drawable/bcktiles">
and the drawable is:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bgsite" android:tileMod开发者_如何学Ce="repeat">
</bitmap>
I dont know where to put #fff
Thanks
You can also create a composite drawable by doing:
drawable/composite.xml
:
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="color drawable" />
<item android:drawable="drawable 1..." />
</layer-list>
And for your color, you can create a shape drawable:
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="color" />
</shape>
In your LinearLayout, you'd want to use android:background="@color/myColor"
if you're referencing a color resource. You can also just put android:background="#FFFFFFFF"
if you don't want to store it as a resource.
精彩评论