我有一个简单按钮的活动(我不能将它作为一个片段,因为它已经扩展了一个父活动)和一个片段活动,它是一个标签主机。是否有可能他们两个共享视图布局的屏幕空间: 活动布局如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/controls"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<LinearLayout
android:id="@+id/control_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageButton
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"/>
<ImageButton
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"/>
<ImageButton
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"/>
<ImageButton
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView
android:id="@+id/addto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<CheckBox
android:id="@+id/addtoCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"/>
</LinearLayout>
</LinearLayout>
FragmentActivity是一个Tab主机,有4个选项卡,布局如下所示:
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@color/coffee"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
高度末尾的活动是否可以显示父布局剩余高度的fragmentActivity?
答案 0 :(得分:1)
活动是屏幕上所有内容的逻辑容器。我想你问的是你是否可以拥有活动1使用的部分屏幕,以及活动2使用的屏幕的另一部分。
不,那是不可能的。