滚动视图ScrollView

编程入门 行业动态 更新时间:2024-10-10 19:25:16

滚动<a href=https://www.elefans.com/category/jswz/34/1770164.html style=视图ScrollView"/>

滚动视图ScrollView

 滚动视图分为两类:ScrollView(水平滚动视图)   HorizontalScrollView(垂直滚动视图)

注意:

(1)垂直滚动,layout_width要设为match_parent,layout_height要设为wrap_content。

(2)水平滚动,layout_width要设为wrap_content,layout_height要设为match_parent。

(3)滚动视图节点,下面必须且只能挂着一个子布局节点

1.垂直滚动视图

<ScrollViewandroid:layout_width="match_parent"android:layout_height="wrap_content"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical">~ 控件 ~ </LinearLayout>
</ScrollView>

2.水平滚动节点

<HorizontalScrollViewandroid:layout_width="wrap_content"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="match_parent"android:orientation="horizontal">~ 控件 ~ </LinearLayout>
</HorizontalScrollView>

3.充满屏幕

有时ScrollView的实际内容不够,又想让其充满屏幕,即使将layout_height值设为match_parent也无效,正确方法是设置:

  android : fillViewport = " true "

更多推荐

滚动视图ScrollView

本文发布于:2023-12-07 09:12:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1670790.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   ScrollView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!