2015-02-01 4 views
0

TabHost로 작업하고 있는데 두 개의 탭이 필요하지만 두 번째 탭의 모든 항목이 첫 번째 탭에 있고 클릭 할 탭 버튼이 없습니다. 어떻게 생겼는지 보여줍니다. IDEA의 디자인 편집기에서 탭 호스트를 드래그 앤 드롭했습니다.TabHost - 첫 번째 탭의 모든 내용

<?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> 

그리고 나서 첫 번째 및 두 번째 선형 레이아웃에 버튼을 추가하기 만하면됩니다. 그러나 나는 말했다. 모든 것이 첫 번째 레이아웃에 있습니다. 내가 알아 내도록 도와 줄 수 있니? 고마워요 :)

답변