如果滚动型只支持一个直接子,我怎么做一个整体布局滚动? [英] If ScrollView only supports one direct child, how am I supposed to make a whole layout scrollable?
本文介绍了如果滚动型只支持一个直接子,我怎么做一个整体布局滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3文本视图中的布局,其中的文字片段对我的Droid 2的底部一点点...... hhow我可以保证整段文字是可见的,并且用户可以向下滚动(只需用他们的手指)看到我的文字的休息吗?
谢谢!
编辑:
< XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< ImageButton的机器人:ID =@ + ID / ImageButton01
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=@可绘制/ DEF
机器人:layout_gravity =顶|中心>
< / ImageButton的>
< TextView的机器人:ID =@ + ID / oneView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=@字符串/ one_def
机器人:layout_gravity =左|中心
机器人:TEXTSIZE =13dip>< / TextView的>
< TextView的Android版本:文本=@字符串/ two_def
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =左|中心
机器人:ID =@ + ID / twoView
机器人:TEXTSIZE =13dip>< / TextView的>
< TextView的Android版本:文本=@字符串/ threedef_def
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =左|中心
机器人:ID =@ + ID / threeView
机器人:TEXTSIZE =13dip>< / TextView的>
< / LinearLayout中>
解决方案
只是包装你目前的LinearLayout与滚动型。所以它应该是水木清华这样的:
< XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
<的LinearLayout
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< ImageButton的... />
< TextView的... />
< TextView的... />
< TextView的... />
< / LinearLayout中>
< /滚动型>
I have 3 text views in a layout, where the text clips a tad on the bottom on my droid 2...hhow can I ensure that the whole text is viewable and the user can scroll down (simply with their finger) to see the rest of my text?
Thanks!
EDIT:
<?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">
<ImageButton android:id="@+id/ImageButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/def"
android:layout_gravity="top|center">
</ImageButton>
<TextView android:id="@+id/oneView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/one_def"
android:layout_gravity="left|center"
android:textSize="13dip"></TextView>
<TextView android:text="@string/two_def"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:id="@+id/twoView"
android:textSize="13dip"></TextView>
<TextView android:text="@string/threedef_def"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:id="@+id/threeView"
android:textSize="13dip"></TextView>
</LinearLayout>
解决方案
Just wrap your current LinearLayout with ScrollView. So it should be smth like this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageButton ... />
<TextView ... />
<TextView ... />
<TextView ... />
</LinearLayout>
</ScrollView>
这篇关于如果滚动型只支持一个直接子,我怎么做一个整体布局滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文