Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I implement a fixed & scrolled view in a layoutInflater?
    text
    copied!<p>I have a layout inflater and a custom arrayAdapter which create a scrolling listview. I want to keep the scrolling listview, but add a navigation bar (tablerow with image buttons or something) to the top and bottom which are independent of the scrolled list. How could I do that?</p> <p>This is what I want to do:</p> <pre><code>+--------------------------------------+ | fixed nav bar | +--------------------------------------+ | scroll listview item | |--------------------------------------| | scroll listview item | |--------------------------------------| | scroll listview item | |--------------------------------------| | scroll listview item | +--------------------------------------+ | fixed nav bar | +--------------------------------------+ </code></pre> <p>This is how I'm instantiating the listAdapter, But I want the addHeaderView() to stay fixed when the the list scrolls:</p> <pre><code>String [] list_array = new String [mCursor.getCount ()]; View vh = getLayoutInflater ().inflate (R.layout.tabtwo_header, null); ListView lv = getListView (); lv.addHeaderView (vh); setListAdapter (new dynAdap (this, android.R.layout.simple_list_item_1, list_array)); </code></pre> <p>My xml layout for the listview:</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_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical"&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:padding="10dip" android:layout_width="fill_parent" android:gravity="left|center" android:textSize="22sp" android:textStyle="bold" android:drawableRight="@drawable/next_icon" android:text="Name Name" android:id="@+id/tv_ListItem" android:background="@drawable/xml_tabtwo"&gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; </code></pre> <p>The ArrayAdapter:</p> <pre><code>public class dynAdap extends ArrayAdapter&lt;String&gt; { String [] list; public dynAdap (Context context, int textViewResourceId, String [] objects) { super (context, textViewResourceId, objects); list = objects; } @Override public View getView (int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater (); View row = inflater.inflate (LAYOUT_TABTWO, parent, false); TextView tv1 = (TextView) row.findViewById (R.id.tv_ListItem); tv1.setText (list[position]); return row; } } </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