0
当选项卡更改时,将活动X加载到FrameLayout中时,我希望该X能够访问位于TabHost之外的tmp
LinearLayout。 假设TmpActivity装入FrameLayout里被点击了一些标签的时候,所以在这个活动我想要做这样的事如何访问位于TabHost的FrameLayout之外的视图?
public void onCreate(Bundle savedInstanceState) {
LinearLayout ll = (LinearLayout)findViewById(R.id.tmp);
}
我怎样才能做到这一点?
<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>