Android Studio App设置线性布局LinerLayout控件垂直/水平方向排列
来源:互联网 发布:vb winhttp 编辑:程序博客网 时间:2024/05/22 03:02
1.线型布局用LinearLayout
2.让控件垂直方向排列用
android:orientation="vertical"注意此时内部控件不能将高度指定为fill_parent和match_parent,因为这样一个控件就把屏幕垂直方向全部占满了,没有其它控件的空间。
垂直方向排列控件的整个xml内容范例如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 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"> <EditText android:id="@+id/input" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <Button android:id="@+id/enter" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="输入"/></LinearLayout>显示效果:
======
3.让控件水平方向排列:
android:orientation="horizontal"
注意此时内部控件不能将宽度指定为fill_parent和match_parent,因为这样一个控件就把屏幕水平方向全部占满了,没有其它控件的空间。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 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="horizontal"> <EditText android:id="@+id/input" android:layout_width="200dp" android:layout_height="wrap_content" /> <Button android:id="@+id/enter" android:layout_width="100dp" android:layout_height="wrap_content" android:text="输入"/></LinearLayout>效果:
0 0
- Android Studio App设置线性布局LinerLayout控件垂直/水平方向排列
- Android Studio App设置线性布局LinerLayout控件占屏幕长宽比例
- Android布局(1)--线性布局(LinerLayout)
- linerlayout 水平方向将控件靠左和靠右
- Linerlayout(线性布局)
- LinerLayout(线性布局)
- Android之Android布局管理:LinerLayout线性布局
- 深入浅出学习 Android之Android布局管理:LinerLayout线性布局
- 深入浅出学习 Android之Android布局管理:LinerLayout线性布局
- 【Android控件布局】Layout 水平平分空间、垂直平分空间
- 【Android控件布局】Layout 水平平分空间、垂直平分空间
- 【Android控件布局】Layout 水平平分空间、垂直平分空间
- PYQT5水平布局后垂直方向控件间距的调整方法
- Android Layout布局使用总结Android中常用的5大布局方式有以下几种: 线性布局(LinearLayout):按照垂直或者水平方向布局的组件。 帧布局(FrameLayout):组件从
- 线性布局Linerlayout-计算器布局实现
- android 图片垂直方向( ScrollView) ,水平方向HorizontalScrollView 滚动
- Android自定义ViewGroup:实现简单的垂直方向线性布局(2)
- Android自定义ViewGroup:实现简单的垂直方向线性布局(2)
- qml构建一个渐变色的窗口
- HBase之表的设计原则
- hdu 2227Find the nondecreasing subsequences(树状数组+dp+离散化)
- NOIP2015模拟1
- ZXing生成二维码,以及给二维码添加Logo
- Android Studio App设置线性布局LinerLayout控件垂直/水平方向排列
- Hibernate关联之 一对多外键单向关联
- oldssoj2677
- G语言图形内核库
- mysql 定时任务
- 抽象的方法能否同时是static、native、synchronized
- Unity3D中Blendshapes之间的过渡方式
- 信号量(Semaphore) 例子
- C++ 图片自适应 picture control 控件大小 不失真显示