android studio线性布局方向,Android Studio App设置线性布局LinerLayout控件垂直/水平方向排列...

本文介绍了如何在Android Studio中使用LinearLayout进行线性布局,包括设置控件的垂直和水平排列。在垂直方向排列时,需注意控件高度不能设为fill_parent或match_parent,以确保其他控件有空间显示。同样,在水平排列时,控件宽度不能设为fill_parent或match_parent。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.线型布局用LinearLayout

2.让控件垂直方向排列用

android:orientation="vertical"注意此时内部控件不能将高度指定为fill_parent和match_parent,因为这样一个控件就把屏幕垂直方向全部占满了,没有其它控件的空间。

垂直方向排列控件的整个xml内容范例如下:

xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"

android:orientation="vertical">

android:id="@+id/input"

android:layout_width="fill_parent"

android:layout_height="

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值