ScrollView的学习
来源:互联网 发布:windows蓝牙抓包工具 编辑:程序博客网 时间:2024/06/05 01:52
ScrollView的宽度和高度设置有什区别呢?
android:layout_width="match_parent" android:layout_height="match_parent"
截图效果(动态图显示的效果太差,在这里句不显示了):
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:overScrollMode="never" android:fadingEdge="none" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:orientation="vertical" > <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> </LinearLayout></ScrollView>
android:layout_width="wrap_content"android:layout_height="wrap_content"
跟上面的效果一样
这样就说明ScrollView的长度和宽度是根据子控件的长度和宽度决定的,ScrollView自己设置宽度和高度不影响显示的效果
另外一个注意的地方就是ScrollView的会限制子空间的“布局”要统一,没有在外层布局中加入ScrollView会显示如下的效果,加入的ScrollView就会全部左边是紫颜色的布局,右边留出一段空白。
<?xml version="1.0" encoding="utf-8"?><LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout android:layout_width="200dp" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="148dp" android:background="#6600a1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:padding="8dp" android:src="@mipmap/back" /> <!--<ImageView--> <!--android:id="@+id/order_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/face"--> <!--/>--> <!--<ImageView--> <!--android:id="@+id/search_back"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:layout_centerVertical="true"--> <!--android:layout_marginLeft="10dp"--> <!--android:padding="8dp"--> <!--android:src="@mipmap/back"--> <!--/>--> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:gravity="center" android:text="选择城市" android:textColor="#fff" android:textSize="18sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginRight="25dp" android:src="@mipmap/search_little" /> </RelativeLayout> </LinearLayout>
0 0
- ScrollView的学习
- Unity3D NGUI ScrollView的学习
- Unity3D NGUI ScrollView的学习
- IOS学习 scrollView的代理
- ScrollView 学习
- 新手上路,scrollview 嵌套listview scrollview嵌套scrollview滑动冲突等问题的学习
- IOS学习 scrollView的基本属性
- IOS学习 scrollView的单张图片缩放
- android:scrollView学习记录
- Scrollview--- legend学习笔记
- ngui学习之scrollview
- Android 学习记录-ScrollView
- Storyboard学习六(ScrollView)
- Unity学习笔记——ScrollView的日常
- Cocos2d-x的学习之旅(八)ScrollView
- Android学习之解决ScrollView嵌套ListView显示的错误
- MeasureSpecx学习(ScrollView中嵌入ListView,GridView冲突的解决)
- React Native 学习笔记九(ScrollView的使用)
- Android存储(读取)之SD卡
- JAVA解析Excel文件的两种方式 --Poi技术
- HDU 2114 Calculate S(n)(立方阶求和公式)
- UIDatePicker日期选择器——基本使用
- 关于tb_info执行sql语句错误
- ScrollView的学习
- 第二章 控制结构和函数
- c语言学习笔记6之进制转换
- iOS 开发常见问题
- c++学习笔记(2)——有关queue
- 学习笔记—面向对象高级篇上(GeekBand)
- Linux下终端的快捷键及建立打开终端的快捷键
- iGrimace iOS7-Ios8系统 NZT NEO 非V8锤子IG基本操作全教程:
- RSA算法之原理篇