Pages

Thursday, September 29, 2011

Android: easy trick to make beautiful background for you Android application


Nice screen background, isn't it? :)
Today I will show you an easy Android design trick how to create very beautiful backgrounds for your Android applications in just 2 minutes!

For example, imagine that you have some simple form like this:
It's pretty boring, huh?

Now let's make this UI screen more attractive. ;-) What we can do with background? Yeah, we can set some fancy solid color or even gradient fill. But it doesn't change entire situation too much.

What is the solution? I recommend you to apply pattern fill for background. All you need is just an seamless pattern image and 1 minute for coding! :)

  1. Find any seamless pattern image that you like and put it into drawable folder (or in drawable-ldpi, drawable-mdpi, etc. folders if you have several images of the same pattern for different screens). 
  2. Create new XML file and put it into drawable folder: (e.g. drawable/background_pattern_fill.xml)

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

where is "background_pattern_image" is your favorite seamless pattern for custom background.
     3. Apply created custom background to any View component:
<LinearLayout
...
android:background="@drawable/background_pattern_fill"
...>


VoilĂ ! Now our UI screen looks much better! You can download the source code here.


More examples:



No comments:

Post a Comment