Android Studio - TabHost with ListView -


i wondering how add tabview listview inside, because looked @ other places , seem not me. , wondering how i'd , navigation playing screen screen. here's xml , java code:

<?xml version="1.0" encoding="utf-8"?> 

<tabhost     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:id="@+id/tabhost"     android:layout_alignparenttop="true"     android:layout_centerhorizontal="true">      <linearlayout         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:orientation="vertical"         android:id="@+id/linearlayout1" >          <tabwidget             android:id="@android:id/tabs"             android:layout_width="fill_parent"             android:layout_height="wrap_content">          </tabwidget>          <framelayout             android:id="@android:id/tabcontent"             android:layout_width="fill_parent"             android:layout_height="wrap_content">              <linearlayout                 android:id="@+id/artists"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:weightsum="1">                  <listview                     android:layout_width="match_parent"                     android:layout_height="match_parent"                     android:id="@+id/artistlist" />              </linearlayout>              <linearlayout                 android:id="@+id/albums"                 android:layout_width="fill_parent"                 android:layout_height="fill_parent"                 android:orientation="vertical">                  <listview                     android:layout_width="wrap_content"                     android:layout_height="match_parent"                     android:id="@+id/albumlist" />             </linearlayout>              <linearlayout                 android:id="@+id/songs"                 android:layout_width="fill_parent"                 android:layout_height="fill_parent"                 android:orientation="vertical">                  <listview                     android:layout_width="wrap_content"                     android:layout_height="match_parent"                     android:id="@+id/songlist" />             </linearlayout>              <linearlayout                 android:id="@+id/more"                 android:layout_width="fill_parent"                 android:layout_height="fill_parent"                 android:orientation="vertical">                  <listview                     android:layout_width="wrap_content"                     android:layout_height="match_parent"                     android:id="@+id/morelist" />             </linearlayout>         </framelayout>          include             android:layout_width="wrap_content"             android:layout_height="match_parent"             layout="@layout/main_bar" />     </linearlayout> </tabhost> 

package m.class_a_frameworks.musicplayerxtske3;  import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.listview; import android.widget.tabhost;   public class activity_listview extends activity {      private listview artistlist;     private listview albumlist;     private listview songlist;     private listview morelist;      private tabhost tabhost;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_listview);            artistlist = (listview)findviewbyid(r.id.artistlist);         albumlist = (listview)findviewbyid(r.id.albumlist);         songlist = (listview)findviewbyid(r.id.songlist);         morelist = (listview)findviewbyid(r.id.morelist);          tabhost tabhost = (tabhost)findviewbyid(android.r.id.tabhost);          tabhost.tabspec tab1 = tabhost.newtabspec("artists");         tabhost.tabspec tab2 = tabhost.newtabspec("albums");         tabhost.tabspec tab3 = tabhost.newtabspec("songs");         tabhost.tabspec tab4 = tabhost.newtabspec("more");           }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if     present.         getmenuinflater().inflate(r.menu.menu_activity_listview, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();     enter code here         if (id == r.id.action_settings) {             return true;         }          return super.onoptionsitemselected(item);     } } 


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -