Note that there are some explanatory texts on larger screens.

plurals
  1. POUse ListView as background of TextView
    text
    copied!<p>I have the below layout which contain mainly:</p> <p>Relative layout, which act as header with Textview and button.</p> <p>and Listview.</p> <p>I would like to make the "header" which is the above relative layout to be transparent and show the listview as user scroll down the list view.</p> <p>I know how to make the layout transparent, but I dont know how to show the listview as background for the "header".</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="fill_parent" android:orientation="vertical" &gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/buttonlayout2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#FFDBE2ED" android:paddingBottom="0dp" android:paddingTop="0dp" &gt; &lt;TextView android:id="@+id/txtTest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:gravity="center_vertical" android:layout_centerVertical="true" android:paddingLeft="0dp" android:text="@string/list_header" android:textColor="#000000" android:textSize="25sp" android:textStyle="bold"&gt; &lt;/TextView&gt; &lt;Button android:id="@+id/btnClear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="0px" android:layout_marginLeft="10px" android:layout_marginRight="3px" android:layout_marginTop="6px" android:height="0dp" android:text="Clear" android:textSize="15sp" android:width="70dp" android:layout_alignParentRight="true" &gt; &lt;/Button&gt; &lt;/RelativeLayout&gt; &lt;ListView android:id="@+id/mylist1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/form" android:layout_alignParentTop="true" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p><img src="https://i.stack.imgur.com/z1i5b.png" alt="screenshot"></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