Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Layout problem for a listview
    text
    copied!<p>I'm trying to add a title to my the elements of my listview. Right now all the information is populated from a static array which consists of several elements but basically now is an Image followed by several different textviews. I would like to have a title bar above the image and textviews but still contained with in the scrollview element (Does this make sense? I'm still trying to get programming jargon down, haha.) I've tried adding a relative layout/textview/tablerow above the imageview to no avail.</p> <p>Here is the LayoutCode</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="?android:attr/listPreferredItemHeight" android:padding="6dip" &gt; &lt;ImageView android:id="@+id/icon" android:layout_width="100sp" android:layout_height="100sp" android:layout_marginRight="6dip" android:src="@drawable/car1" /&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/make" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center_vertical" android:textColor="#000" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>This is all contained in this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;RelativeLayout android:orientation="vertical" android:background="@drawable/banner" android:layout_width="fill_parent" android:layout_height="50sp" android:gravity="center" &gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:orientation="vertical" android:background="#FFFFF0" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="fill_vertical"&gt; &lt;Button android:text="Change Location" android:id="@+id/ListingsLocationbtn" android:layout_height="wrap_content" android:gravity="center" android:layout_width="100sp" android:layout_margin="3sp"&gt;&lt;/Button&gt; &lt;Button android:id="@+id/ListingsDetailsbtn" android:text="Details" android:layout_toRightOf="@+id/ListingsLocationbtn" android:layout_alignTop="@+id/ListingsLocationbtn" android:layout_alignBottom="@+id/ListingsLocationbtn" android:layout_height="match_parent" android:gravity="center|center_vertical" android:layout_width="100sp" android:layout_margin="3sp"&gt;&lt;/Button&gt; &lt;Button android:layout_height="wrap_content" android:id="@+id/ListingsFilterbtn" android:text="Filter Results" android:layout_alignParentRight="true" android:layout_width="100sp" android:gravity="center" android:layout_margin="3sp"&gt;&lt;/Button&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:orientation="vertical" android:background="#FFFFF0" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="fill_vertical"&gt; &lt;TextView android:id="@+id/zipcodeTV" android:paddingTop="2sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000" android:textStyle="bold"/&gt; &lt;/RelativeLayout&gt; &lt;ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFF0" /&gt; &lt;TextView android:id="@+id/android:empty" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/main_no_items" android:textColor="#000" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>*I deleted some of the textviews as my code didn't take over the entire page</p> <p><img src="https://i.stack.imgur.com/DE6l1.png" alt="enter image description here"></p> <p>Thanks in advance for the help :)!</p>
 

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