Android 滚动视图
2018-01-31 22:47
155 查看
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> //水平滚动 <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="200dp"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent"> <View android:layout_width="400dp" android:layout_height="match_parent" android:background="#aaffff"/> <View android:layout_width="400dp" android:layout_height="match_parent" android:background="#ffff00"/> </LinearLayout> </HorizontalScrollView> //垂直滚动 <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="400dp" android:background="#00ff00"/> <View android:layout_width="match_parent" android:layout_height="400dp" android:background="#ffffaa"/> </LinearLayout> </ScrollView> </LinearLayout>[/code]
有时候 ScrollView 的实际内容不够,又想让它充满屏幕,如果laout_height 属性赋值为match_parent,那么如果还是不会充满,正确的做法是再增加一行 fillViewport的属性设置android:layout_height="match_parent" android:fillViewport="true"[/code]
相关文章推荐
- android使用滚动视图
- android 滚动视图(ScrollView)
- Android零基础入门第61节:滚动视图ScrollView
- 由浅入深 细细体会Android的视图滚动
- Android视图之滚动视图
- Android零基础入门第61节:滚动视图ScrollView
- Android布局控件之ScrollView(滚动视图)
- Android零基础入门第61节:滚动视图ScrollView
- 阅读《Android 从入门到精通》(21)——滚动视图
- Android复习之滚动视图scrollview
- Android 判断一个视图是否滚动到顶部
- Android——图片视图(ImageView)、状态开关按钮(ToggleButton)、时钟、图片透明度、滚动和时间选择器
- Android 程式开发:(五)屏幕组件 —— 5.7 ScrollView滚动视图
- Android View.scrollTo, View.scrollBy控制视图滚动原理
- android-UI组件实例大全(十二)------ScrollView滚动视图
- 从零開始学android<ScrollView滚动视图.十八.>
- Android中滚动视图(ScrollView、HorizontalScrollView)的使用
- android开发教程之使用线程实现视图平滑滚动示例
- Android可滚动视图隐藏Toolbar实现