Adding PNG and color to the background

I have a LinearLayout and I have a png that I used as tiles, but I also want the color behind it to be white.

Is it 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 valid:

    <?xml version="1.0" encoding="utf-8"?>
 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/bgsite" android:tileMode="repeat">
    </bitmap>

I don't know where to put #fff

thank

+3
source share
2 answers

You can also create composite output by following these steps:

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:

<shape 
xmlns:android="http://schemas.android.com/apk/res/android">
  <solid android:color="color" />
</shape>
+4
source

In your LinearLayout you want to use android:background="@color/myColor"if you are referencing a color resource. You can also just put android:background="#FFFFFFFF"it if you do not want to store it as a resource.

0
source

All Articles