Android控件之ScrollView探究详解编程语言

本文章主要介绍了Android控件之ScrollView探究,具有不错的的参考价值,希望对您有所帮助,如解说有误或未考虑完全的地方,请您留言指出,谢谢!

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

ScrollView只支持垂直滚动。

以下为案例

main.xml布局文件

<? 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 "
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控件之ScrollView探究详解编程语言

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/228178.html

(0)
上一篇 2022年1月11日
下一篇 2022年1月11日

相关推荐

发表回复

登录后才能评论