Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reduce listview item height
    text
    copied!<p>I have an expandable listview. The rows consist of a textview and a custom checkbox. The size of the checkbox depends on the textview's text size. There are only two available sizes. When the large checkbox is shown, the difference between the rows is small. When the small checkbox is shown, it looks big. How can I reduce the row height between the rows?</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/childlayout" android:orientation="vertical"&gt; &lt;RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_centerVertical="true" android:layout_height="wrap_content" android:layout_marginLeft="50dp" &gt; &lt;TextView android:id="@+id/child_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="center_vertical" android:textColor="#000000"/&gt; &lt;/LinearLayout&gt; &lt;CheckBox android:id="@+id/multiple_checkbox" android:layout_width="wrap_content" android:layout_centerVertical="true" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:checked="true" android:layout_marginRight="10dp" android:button="@drawable/productlists_custom_cb" android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" /&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>If I set the layout_height of the relative layout to 30dp, the row height will be smaller. But this shouldn't be the way.</p> <p>This is the .xml for setting the smaller checkbox on and off:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_checked="true" android:drawable="@drawable/cbon348" /&gt; &lt;item android:state_checked="false" android:drawable="@drawable/cboff348" /&gt; &lt;/selector&gt; </code></pre> <p>One could think the canvas for the image is much bigger than the image itself, but I assure you, it isn't.</p> <p><img src="https://i.stack.imgur.com/JUYhm.png" alt="enter image description here"></p> <p>EDIT:</p> <p>I simplified the code to as below, and still nothing:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/childlayout" android:orientation="horizontal"&gt; &lt;TextView android:id="@+id/child_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="50dp" android:gravity="center_vertical" android:textColor="#000000"/&gt; &lt;CheckBox android:id="@+id/multiple_checkbox" android:layout_width="wrap_content" android:layout_gravity="center_vertical" android:gravity="center_vertical" android:layout_height="wrap_content" android:checked="true" android:layout_marginRight="10dp" android:button="@drawable/productlists_custom_cb" android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" /&gt; &lt;/LinearLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload