Reputation: 4547
I am rendering a ListView
that consists of image. I wish to get rid to the plane grey color. How do I get rid of that ? Seems, to be weird and rather easy one but I am unable to figure out the solution.
list_View.xml
<?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="#efefef"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="@android:color/black"
android:dividerHeight="1.0sp"
android:textColor="#000000" />
</RelativeLayout>
image.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#A4A4A4"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageStatus"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
</LinearLayout>
Upvotes: 4
Views: 650
Reputation: 3017
try this as an attribute to your image view
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
...>
<ImageView
...
android:scaleType="matrix" />
</LinearLayout>
Upvotes: 1
Reputation: 16152
<ImageView
android:id="@+id/imageStatus"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY" <!-- This will Help you -->
android:adjustViewBounds="true" />
You can also set Minimum Width & Height using >>>
android:minHeight="120dp"
android:minWidth="100dp"
Upvotes: 3
Reputation: 16053
Edit your code to the following in the listview:
android:layout_height="wrap_content"
Upvotes: 2