任何人都可以帮助我如何为linearlayout启用滚动功能吗?如何在android中启用滚动功能以线性布局?
11
A
回答
11
使用ScrollView?
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="110px">
0
包装你的内容的滚动型
内
10
你可以把任何一个滚动视图内做出点(的LinearLayout,RelativeLayout的和等)滚动。您可以按照http://www.androidpeople.com/android-scrollview-example了解更多详情。
0
滚动视图只能有一个项目在它.. 所以要启用的功能,你必须把线性布局(一般..)和 作为孩子添加自定义视图或布局,线性布局..
我建议你使用listview和ArrayLists来生成一个滚动列表
0
滚动视图将只带一个直接的孩子在它下面。你可以使用这个代码作为sample.hope这将帮助你。
<TableLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<TableLayout android:id="@+id/syncservice_url" android:layout_width="wrap_content" android:layout_height="match_parent" >
<TextView android:text="Settings" android:textColor="@color/Black" android:textSize="6pt" android:typeface="serif"/>
<View android:background="@color/Black" android:layout_height="1dip" android:layout_marginBottom="5dip"/>
<TextView android:text="Multimedia file list Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/multimediafileListUrl" android:layout_height="40dip"></EditText>
<TextView android:text="Multimedia Download Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/MultiMediaDownloadUrl" android:layout_height="40dip"></EditText>
<TextView android:text="Reports Upload Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/ReportUploadUrl" android:layout_height="40dip"></EditText>
<TextView android:text="Presentation Timimg Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/PresentationTimeUrl" android:layout_height="40dip"></EditText>
</TableLayout><!-- sync scrvice closed -->
<TableLayout android:id="@+id/report_url" android:layout_width="wrap_content" android:layout_height="match_parent" >
<TextView android:text="Reporting " android:textColor="@color/Black" android:textSize="6pt" android:typeface="serif"/>
<View android:background="@color/Black" android:layout_height="1dip" android:layout_marginBottom="5dip"/>
<TextView android:text="Report Submit Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/ReportSubmitUrl" android:layout_height="40dip"></EditText>
<TextView android:text="Appointment List Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:gravity="left" android:maxLines="1"
android:layout_marginRight="10dip"
android:cursorVisible="false" android:layout_width="match_parent"
android:layout_height="40dip" android:id="@+id/AppointMentListUrl" />
</TableLayout><!-- sync Report closed -->
<TableLayout android:id="@+id/Locationmap_url" android:layout_width="wrap_content" android:layout_height="match_parent" >
<TextView android:text="IMEI Post Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/IMeiPostUrl" android:layout_height="wrap_content"></EditText>
<TextView android:text="Kml Download Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/kmldownloadurl" android:layout_height="wrap_content"></EditText>
<Button android:text="Save" android:id="@+id/SettingSave" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</TableLayout><!--Locationmap closed -->
</TableLayout><!-- main table layout -->
</TableLayout><!-- main table layout -->
</ScrollView>
0
使用滚动型,提供他的宽度和长度,然后使用任何布局或视图,为他们提供他们的宽度和高度。
3
将您的内容里面滚动型
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView android:id="@+id/ScrollViewID"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<!-- your content --->
</ScrollView>
</LinearLayout>
相关问题
- 1. 在线性布局中启用水平滚动
- 2. 如何使线性布局可滚动?
- 3. Android动画线性布局
- 4. 如何在一个线性布局中滚动2个GridViews?
- 5. 滚动线性布局超出内容
- 6. 使线性布局可滚动
- 7. Android:使用三种线性布局的水平滚动视图
- 8. 如何居中布局? - 线性布局
- 9. 如何在android studio中动态添加/删除线性布局
- 10. 如何在线性布局
- 11. Android:如何在线性布局内设置网格布局?
- 12. Android线性布局不填充滚动视图
- 13. 如何在Android应用中制作可滚动布局和可缩放布局?
- 14. Android如何将AdView对齐以线性布局为中心
- 15. 滚动查看不滚动到线性布局顶部
- 16. 如何使线性布局水平滚动
- 17. 在android中的对齐线性布局
- 18. 的Android线性布局与动画
- 19. Android线性布局z-order动画
- 20. 如何在android中使用线性布局来制作gridview?
- 21. 动态添加滚动视图在滚动视图中的布局和线性布局
- 22. 启用特定布局的滚动
- 23. 如何使线性布局在动态添加内容时自动滚动
- 24. 如何布局?使用相对布局还是线性布局?
- 25. 制作Android布局滚动
- 26. Android可滚动布局
- 27. Android的布局和滚动
- 28. Android线性布局错误
- 29. 线性布局对齐 - Android
- 30. Android:线性布局新行
删除称呼:“在此先感谢,\ n Sathish所在”,不这样做,下一次 – 2015-05-21 18:18:34