1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > android linearlayout 方法 android布局----LinearLayout布局方式

android linearlayout 方法 android布局----LinearLayout布局方式

时间:2020-11-15 13:37:50

相关推荐

android linearlayout 方法 android布局----LinearLayout布局方式

线性布局,控件成直线方式排列,要么水平排列,要么垂直排列。

对着layout文件夹右键,然后选择新建android xml file,选择资源类型选择 layout --> 根节点选择 LinearLyout

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#FF0000"

android:text="第一个TextView"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#00FF00"

android:text="第二个TextView">

android:orientation设置方向(垂直(vertical)和水平(horizontal)),如果设置布局方向是水平的话,那么控件的width就不要设置为相对父控件,不然其他控件就会被挤出屏幕外面去了。

效果:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。