White Space Around List View Items
I am having a list view and its list items are generated using Array List and it creates unecessary white space which occupies much space. How do I remove it from the list items? H
Solution 1:
just remove android:dividerHeight="10.0sp" from xml or make it 1sp or smaller
this may also the problem: android:layout_height="0dp" android:layout_weight="1"
why not giving height as "wrap_content" ? no need to android:layout_weight="1" i think
Solution 2:
use height wrap-content
for relativelayout in listitems.xml
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="wrap_content"></RelativeLayout>
Solution 3:
Try this for your row, change image and color to yours ..(Use linear)
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/LinearLayout1"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="#123133" ><ImageViewandroid:id="@+id/photo"android:layout_width="140dip"android:layout_height="140dip"android:paddingLeft="15dp"android:paddingRight="15dp"android:src="@drawable/ic_launcher" /><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="match_parent"android:orientation="vertical"android:gravity="center"><TextViewandroid:id="@+id/name"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="AAAAASDKDJ"android:textColor="#000000"android:textSize="14sp"android:textStyle="bold" /><TextViewandroid:id="@+id/itemDescription"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="AAAAASDKDJ" /><TextViewandroid:id="@+id/price"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="AAAAASDKDJ"android:textColor="#32cd32"android:textSize="19sp"android:textStyle="bold" /></LinearLayout></LinearLayout>
Solution 4:
The property android:dividerHeight="10.0sp"
is making all the extra space. Put something lower like 3sp
or 5sp
.
Post a Comment for "White Space Around List View Items"