Android 滚动查看TabHost中的TableLayout
我试图滚动嵌套在选项卡中的TableLayout。我可以按预期滚动表格,但问题是当表格向上滚动时,它会在滚动时显示在选项卡后面 我只想使表格部分的布局滚动 最后有一个RelativeLayout,它作为我将在表中以行的形式动态显示的信息的图例(键指南)。因此,它需要在屏幕的底部,不应该像表格一样滚动。但是在这段代码中,标签下面的所有内容都会向上滚动(RelativeLayout除外)Android 滚动查看TabHost中的TableLayout,android,xml,scrollview,Android,Xml,Scrollview,我试图滚动嵌套在选项卡中的TableLayout。我可以按预期滚动表格,但问题是当表格向上滚动时,它会在滚动时显示在选项卡后面 我只想使表格部分的布局滚动 最后有一个RelativeLayout,它作为我将在表中以行的形式动态显示的信息的图例(键指南)。因此,它需要在屏幕的底部,不应该像表格一样滚动。但是在这段代码中,标签下面的所有内容都会向上滚动(RelativeLayout除外) //固定在屏幕上 //固定在屏幕上 //仅在选项卡内滚动此内容 //固定在屏幕最底部,所以这个和标签之间的区域
//固定在屏幕上
//固定在屏幕上
//仅在选项卡内滚动此内容
//固定在屏幕最底部,所以这个和标签之间的区域是滚动的
简而言之,我希望在屏幕上固定以下内容:
- 账单
- 第一张桌子的布局
- 最后的亲戚
包装内容
或填充家长
一样简单。但我似乎无法理解这一点
谢谢
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false"
android:orientation="vertical">
//Fixed On Screen
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<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>
//Fixed On Screen
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:padding="4dp" >
<TextView
style="@android:style/TextAppearance.Medium"
android:layout_weight="1"
android:text="@string/start"
android:textStyle="bold"
android:typeface="serif" />
<TextView
style="@android:style/TextAppearance.Medium"
android:layout_weight="1"
android:text="@string/end"
android:textStyle="bold"
android:typeface="serif" />
<TextView
style="@android:style/TextAppearance.Medium"
android:layout_weight="1"
android:paddingLeft="5dp"
android:text="@string/effect"
android:textStyle="bold"
android:typeface="serif" />
</TableRow>
</TableLayout>
</LinearLayout>
//Scroll this content inside the Tab ONLY
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableLayout
android:id="@+id/Tab1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="4dp"
android:stretchColumns="*" >
</TableLayout>
<TableLayout
android:id="@+id/Tab2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="4dp"
android:stretchColumns="*" >
</TableLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
</TabHost>
//Fixed On Screen at the very bottom so the area between this and Tab is what scrolls
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@color/green"
android:padding="5dp"
android:text="@string/excellent"
android:textColor="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@color/light_blue"
android:padding="5dp"
android:text="Good"
android:textColor="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@color/dark_gray"
android:padding="5dp"
android:text="@string/normal"
android:textColor="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@color/red"
android:padding="5dp"
android:text="Bad"
android:textColor="#FFFFFF" />
</TableRow>
</RelativeLayout>