Добавление 6 TabSpec к одному tabhost - PullRequest
0 голосов
/ 02 февраля 2012

Как я могу добавить 6 tabspec к одному tabhost? Могу ли я использовать любую прокрутку к tabhost? Заранее спасибо.

Ответы [ 2 ]

0 голосов
/ 02 февраля 2012

используйте этот код

<?xml version="1.0" encoding="utf-8"?>
<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"  >
  <LinearLayout
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent">
  <HorizontalScrollView 
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:fillViewport="true"
       android:scrollbars="none">
  <TabWidget 
       android:id="@android:id/tabs"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"/>
  </HorizontalScrollView>
  <FrameLayout
       android:id="@android:id/tabcontent"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" />
  </LinearLayout>
</TabHost>

, если хотите прокрутить.

0 голосов
/ 02 февраля 2012

Tabhost настроить их на экране. Вы можете добавить их как

TabHost tabHost;
TabHost.TabSpec spec;
 tabHost=getTabHost()
 Intent intent;
   intent=new Intent().setClass(this, BirthDayTab.class);
 spec=tabHost.newTabSpec("artists").setIndicator("BirthDay",res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
   tabHost.addTab(spec);

Используйте его в течение 6 раз или сделать метод для вызова его 6 раз.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...