ViewGroups
排列方向
这段代码可以实现竖直排列。
可以vertical 下面的代码运行没有问题,但是为什么没有竖直排列?
没有vertical 将前一段代码的三行
android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" >~~~替换第二段代码的那三行,OK。![可以vertical了](http://upload-images.jianshu.io/upload_images/2994271-86d99e8c050e6972.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/240)差别是:android:orientation="vertical" >对的;android:layout_orientation = "vertical"错的当然排列方向可以横排horizental或者竖排vertical####高度宽度视图的高度、宽度都可以是固定的、wrap_content和match_parent试验如下代码:
android:layout_width = "wrap_content"android:layout_height = "wrap_content"android:orientation="vertical" >
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textSize="36sp"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/black"
android:background="#ccddff"
android:padding="20dp"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="36sp"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/black"
android:background="#ccddff"
android:padding="20dp"/>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="36sp"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/black"
android:background="#ccddff"
android:padding="20dp"/>
![好乱](http://upload-images.jianshu.io/upload_images/2994271-080ea32a08896330.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/480)如果想要均衡地将这些视图分布在device上,简单暴力地这样固定长度高度或者match_parent、wrap_content是行不通的。我们去搜索一下LinearLayout有没有办法实现均衡布局?let's Google search for a potential solution to the problem.![可以得到一大堆结果](http://upload-images.jianshu.io/upload_images/2994271-17d74fb8b9750c54.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/480)[这个网站](http://stackoverflow.com)在你需要其他人帮助时,可以查找问题答案,别人可能已经遇到了同样的问题,并且提出了答案。或者贴出问题,让别人来帮助你。网站手机打不开那也没办法!![Paste_Image.png](http://upload-images.jianshu.io/upload_images/2994271-a4582ff494d22634.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/480)提示我们可以使用layout_weight属性。
更多相关文章
- android Timer的用法实例
- Android(安卓)代码执行Linux Shell小记
- android 横向滚动屏幕实现(1)
- Android中Crash(闪退,崩溃)的一般问题与解决方案
- android弹出框2(相当于通知)
- Android(安卓)1.5 1.6 2.0 2.1 2.2 2.3 3.0,4.0的区别
- Android(安卓)NDK学习 简介
- Android中拍照、图片、录音、视频和音频功能的方法和代码
- android:屏幕自适应