2015-02-01 2 views
0

Я работаю с TabHost, и я хочу иметь две вкладки, но все, что у меня есть на второй вкладке, находится на первой вкладке, и кнопка для вкладок не нажата. Вот как это выглядит. Я просто перетаскивать tabhost в редакторе дизайна в IDEATabHost - все в первой вкладке

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 


    <TabHost 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" android:id="@+id/tabHost2" android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true"> 
     <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical"> 
      <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="fill_parent"> 
       <LinearLayout 
         android:id="@+id/linearLayout2" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:orientation="vertical"> 
        <Button 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:text="Button1" 
          android:id="@+id/button2"/> 
       </LinearLayout> 
       <LinearLayout 
         android:id="@+id/linearLayout" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:orientation="vertical" > 
        <Button 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Button2" 
          android:id="@+id/button3"/> 
       </LinearLayout> 
      </FrameLayout> 
     </LinearLayout> 
    </TabHost> 
</RelativeLayout> 

А потом я просто кнопку для первой и второй линейной компоновки добавить. Но, как я уже сказал. Все в первом макете. Не могли бы вы помочь мне разобраться? Спасибо :)

ответ

Смежные вопросы