2012-03-06 5 views
0

Tab이 변경되었을 때 ActivityL이 FrameLayout에로드되면 X가 TabHost 외부에있는 tmp LinearLayout에 액세스 할 수 있기를 원합니다. 일부 탭을 클릭 한 때 활동에 나는이 작업을 수행 할 수있는 방법이TabHost의 FrameLayout 외부에있는보기에 액세스하는 방법?

public void onCreate(Bundle savedInstanceState) { 
     LinearLayout ll = (LinearLayout)findViewById(R.id.tmp);    
    } 

그런 짓을 할 수 있도록 , TmpActivity는 FrameLayout이에로드되는 것을 가정?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

     <LinearLayout 
       android:id="@+id/tmp" 
       android:orientation="vertical" 
       android:layout_width="fill_parent" 
       android:layout_height="50px" 
       android:background="#00FF00">    
     </LinearLayout> 

     <TabHost 
      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" 
       android:padding="5dp"> 

       <FrameLayout 
        android:id="@android:id/tabcontent" 
        android:layout_width="fill_parent" 
        android:layout_height="500px" 
        android:padding="5dp" 
        android:background="#FF0000"/> 
       <TabWidget 
        android:id="@android:id/tabs" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:background="#FF00FF" /> 
      </LinearLayout> 
     </TabHost> 
</LinearLayout> 

답변

0

귀하의 탭 호스트 프레임 레이아웃에로드 된 활동에서 상위 활동을 얻을 수 있습니다. 거기에서 TabHostActivity에있는 getter 또는 멤버 변수를 통해 선형 레이아웃에 액세스 할 수 있습니다.