Android: How to resize BackgroundDrawable for a Linear Layout dynamically -


i have set backgorunddrawbale linearlayout. backgrounddrawable has greater height linearlayout , ignores defined height in xml layout (besides don't want use absolute height "wrap_content") - , therefore increases height of layout. there way scale drawable dynamically doesn't increase height? - or have crop drawable e.g in photoshop right height? - there must way.

i wrapped head around similar questions on stackoverflow use relativelayout. didn't desired result.

my layout looks following, used in listview first row. layout should end below image - doesn't because of drawable.

listview linearlayout @ first row

currently using following xml layout.

 <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/black"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/foto_detail_bg_cell_0" > <imageview android:id="@+id/icon" android:layout_width="100px" android:layout_height="100px" android:layout_marginright="6dip" android:layout_margintop="6dip" android:layout_marginbottom="6dip" android:src="@drawable/icon" /> <linearlayout android:orientation="vertical" android:paddingtop="5dip" android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" > <textview android:id="@+id/toptext" android:layout_width="fill_parent" android:layout_height="0dip" android:ellipsize="marquee" android:layout_weight="1" android:paddingleft="10dip" android:gravity="center_vertical" android:textstyle="bold" android:textsize="14dip" /> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputtype="textmultiline" android:maxlines="3" android:scrollhorizontally="false" android:layout_weight="1" android:paddingleft="10dip" android:id="@+id/bottomtext1" android:singleline="true" android:ellipsize="marquee" android:textsize="14dip" /> <textview android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:paddingleft="25dip" android:id="@+id/bottomtext2" android:singleline="true" android:ellipsize="marquee" android:textsize="14dip" /> </linearlayout> </linearlayout> 

i glad hints.

finally made background image smaller height of layout. gets scaled (stretched) automatically right size.


Comments