How to add padding for background image

Posted by michael on Stack Overflow See other posts from Stack Overflow or by michael
Published on 2010-04-26T05:38:38Z Indexed on 2010/04/26 5:43 UTC
Read the original article Hit count: 144

Filed under:

Hi,

I have a linear layout which has a background image (a 9 patched png file). How can I add padding to left and right so that the background image does not take up the whole width? I have tried 'android:paddingLeft' and 'android:paddingRight', but that does not change anything.

<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="25dip"
android:paddingRight="25dip"
android:background="@drawable/background">

The whole background still stretches the whole screen width.

Thank you for any help.

© Stack Overflow or respective owner

Related posts about android