Note that there are some explanatory texts on larger screens.

plurals
  1. POListview items appear under tab in tabview
    primarykey
    data
    text
    <p>When this displays the first two rows of the listview appear under the tabs, the Mercury, and Venus planets. How do I get the tabs to occupy the top and the listview rows to start after the tabs?</p> <p><strong><em>tablistmenu.xml:</em></strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:id="@+id/textview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="" /&gt; &lt;TextView android:id="@+id/textview2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="" /&gt; &lt;TextView android:id="@+id/textview3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="" /&gt; &lt;TextView android:id="@+id/textview4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="" /&gt; &lt;/FrameLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ListView android:id="@+id/lstMain" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; </code></pre> <p><strong><em>tablistmenu.java:</em></strong></p> <pre><code>public class tablistmenu extends TabActivity { private ListView mainListView ; private ArrayAdapter&lt;String&gt; listAdapter ; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tablistmenu); TabHost mTabHost = getTabHost(); mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Contacts", getResources().getDrawable(R.drawable.contact_32)).setContent(R.id.textview1)); mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Credit Cards", getResources().getDrawable(R.drawable.credit_card_32)).setContent(R.id.textview2)); mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("Notes/Misc", getResources().getDrawable(R.drawable.notes_32)).setContent(R.id.textview3)); mTabHost.addTab(mTabHost.newTabSpec("tab_test4").setIndicator("Websites", getResources().getDrawable(R.drawable.globe_32)).setContent(R.id.textview4)); mTabHost.setCurrentTab(0); // Find the ListView resource. mainListView = (ListView) findViewById( R.id.lstMain); // Create and populate a List of planet names. String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"}; ArrayList&lt;String&gt; planetList = new ArrayList&lt;String&gt;(); planetList.addAll( Arrays.asList(planets) ); // Create ArrayAdapter using the planet list. listAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.simplerow, planetList); // Set the ArrayAdapter as the ListView's adapter. mainListView.setAdapter( listAdapter ); // End } } } </code></pre> <p>thanks, Dean</p>
    singulars
    1. This table or related slice is empty.
    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.
    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