Note that there are some explanatory texts on larger screens.

plurals
  1. POCenter list item vertically on ListView
    primarykey
    data
    text
    <p>I'm developing an Android application.</p> <p>On one activity I have a List with list items. Those list items will have a TextView (I'm using my own layout because probably I will need to add more widgets to it).</p> <p>This is ListActivity xml:</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="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="469dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="40dp"&gt; &lt;/ListView&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/orderErrorMsg" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:textSize="16dp" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>And this is ListItem xml:</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="match_parent" android:layout_height="100dp" android:orientation="vertical"&gt; &lt;TextView android:id="@+id/orderToFillName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textSize="20dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>And, finally, this is the result:</p> <p><img src="https://i.stack.imgur.com/uyroq.png" alt="enter image description here"></p> <p>Why TextView is not centered vertically?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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