tags:

views:

220

answers:

1

I have an image, say 16px from our designer. I want to Set it as the background image on a view, but the view is larger than the image. So I want to anchor the image at the top of the view, and then have the view fill in the bottom with a solid color.

Is this possible in the current version of android, 1.5_r3?

Here is what I have so far, but the image is scaling to take up the entire view, and I am not sure how to set the image as background and specify a solid color at the same time. I suspect I need to wrap the view in a containing view which has the color specified, is that the best way to do it?

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="3dip"
style="@style/listItemStyle">...

Where listItemStyle is defined as:

 <style
  name="listItemStyle"
  parent="@android:style/Widget.ListView">
   <item name="android:background">@drawable/list_background</item>
 </style>
A: 

Place your image in a ImageView, and then use the solid color as a background of the item view. This is one alternative.

Cheers

tdelev