【发布时间】:2011-08-09 08:33:09
【问题描述】:
我已经制作了一个布局,我想从现有的 xml 文件中设置另一个布局。这可能吗?
见以下代码:
<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">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a tab" />
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab" />
<TextView
android:id="@+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab" />
</FrameLayout>
</LinearLayout>
现在我想在 frameLayout 中设置 Layout` 这怎么可能?
谢谢。
【问题讨论】:
-
你想动态添加布局吗(意味着在活动中)?
-
不,我已经在 Xml 文件中创建了 Both 布局,对于 Main Activity 的公共视图,我想使用该技巧。我想在活动调用中调用另一个内部视图。 . .怎么可能?
-
请检查我已经更新了我给出的代码的问题
标签: android android-emulator android-layout android-widget