Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android image background repeat

I have a image used for a LinearLayout background Let's say image has 20x100 px I want to make the image repeat only on x axes ... something like this in css

background-repeat:repeat-x;

The LinearLayout is kinda big (1024 x 680 px) so my image will cover the entire width but only in the top (the rest of 580 px of height will be transparent) I hope i was clear Thanks

like image 991
tinti Avatar asked Feb 14 '12 14:02

tinti


1 Answers

try using android:tileMode

create background.xml in drawable folder as:

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

and then use it in your layout xml as:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >
like image 185
Zeba Avatar answered Oct 19 '22 21:10

Zeba