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

本文介绍了如何在Android Studio中使用LinearLayout进行控件的垂直和水平排列。通过设置`android:orientation="vertical"`实现垂直排列,注意避免使用`fill_parent`和`match_parent`以确保所有控件能显示。而使用`android:orientation="horizontal"`则实现水平排列,同样要避免宽度占满屏幕。给出了具体的XML代码示例。
摘要由CSDN通过智能技术生成

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、付费专栏及课程。

余额充值