Android控件之ScrollView用法实例分析_安卓软件开发教程-查字典教程网
Android控件之ScrollView用法实例分析
Android控件之ScrollView用法实例分析
发布时间:2016-12-28 来源:查字典编辑
摘要:本文实例讲述了Android控件之ScrollView用法。分享给大家供大家参考。具体如下:ScrollView滚动视图是指当拥有很多内容,...

本文实例讲述了Android控件之ScrollView用法。分享给大家供大家参考。具体如下:

ScrollView滚动视图是指当拥有很多内容,屏幕显示不完时,需要通过滚动跳来显示的视图。

ScrollView只支持垂直滚动。

以下为案例

main.xml布局文件:

<"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" android:scrollbars="vertical"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/p1" android:layout_gravity="center_horizontal"/> </LinearLayout> </ScrollView>

显示效果如下图所示:

希望本文所述对大家的Android程序设计有所帮助。

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新安卓软件开发学习
    热门安卓软件开发学习
    编程开发子分类