Layout Background texture in android

Frequently used code samples and tutorials
vivekkalady
Site Admin
Posts: 35
Joined: Tue Nov 18, 2014 2:39 pm

Layout Background texture in android

Postby vivekkalady » Fri Nov 21, 2014 5:57 pm

Pick something from Subtle Patterns, e.g. irongrip.png and drop it in your drawable-hdpi folder

Make a BitmapDrawable, e.g. irongrip_repeating.xml

Code: Select all

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


Apply it to a View

Code: Select all

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="@drawable/irongrip_repeating"
   android:orientation="vertical">
</LinearLayout>

Return to “Tutorials & Examples”

Who is online

Users browsing this forum: No registered users and 1 guest

cron