【发布时间】:2011-12-04 17:20:46
【问题描述】:
这是示例 XML
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_margin="5dip" android:background="#FF992222">
<ScrollView android:layout_height="wrap_content"
android:layout_width="fill_parent">
<LinearLayout android:layout_height="wrap_content"
android:orientation="vertical" android:layout_width="fill_parent">
<TextView android:layout_width="wrap_content" android:text="TextView"
android:layout_height="wrap_content" android:textSize="24dip"></TextView>
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_margin="5dip" android:background="#FF555555">
<TextView android:layout_width="wrap_content" android:text="TextView"
android:layout_height="wrap_content" android:textSize="24dip"></TextView>
</LinearLayout>
</LinearLayout>
结果是这样的:
如果你注意到的话,上面的LinerLayout 中的文本被LinearLayout 和ScrollView 包裹住了。
如果继续添加上面的内容,它会是这样的
底部线性布局将在 ScrollView 变为活动状态之前被推出屏幕并使第一个内容变为可滚动......我不希望发生这种情况......
在底部视图被推出屏幕之前,我应该怎么做才能使滚动视图像这样:
(这是经过编辑的图像,不是由 Android 布局编辑器创建的)
希望问题足够清楚.. 谢谢:)
【问题讨论】:
-
为什么不把所有东西都放在一个滚动视图中。
-
所以您根本不希望灰色文本视图移动而红色文本视图保持可滚动,对吗?
标签: android layout scrollview