菜鸟相对布局笔记
来源:互联网 发布:java ip查地区 编辑:程序博客网 时间:2024/06/05 07:56
1 .<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:padding="30px" 定义各控件离边框的距离
tools:context=".MainActivity" >
<TextView
android:id="@+id/label" 为文字加入类内部
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点击我" />
<EditText
android:id="@+id/labol"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background" 定义背景颜色
android:layout_below="@id/label" layout below 在某某的下面 @id/label 此组键代表 TextView ,此文本定义在此组键的下边,
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/labol" 文字定义在文本框的下边
android:id="@+id/entry"
android:layout_alignParentRight="true" 定义在父界面的右边
android:layout_marginLeft="10px" 定义此组键左边的间距
android:text="OK"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/entry" 与组键Entry同高
android:layout_alignBottom="@+id/entry" 与组键同大小
android:layout_toLeftOf="@+id/entry" 在组建的左边
android:text="Concel" />
android:id="@+id/root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30px" 界面离实际内容距离
>
<RelativeLayout 嵌套相对布局
android:layout_width="fill_parent"
android:layout_height="wrap_content" 此时高度只能包裹内容的高度
>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入手机号码:"
android:layout_alignParentLeft="true" 定义在容器的左边
android:padding="20px" 间距20px
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/text" 定义在某某的右边
android:layout_alignLine="@id/text" 与button同一水平线
android:id="@+id/number"
/>
></RelativeLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入内容:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:id="@+id/content"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="发送"
android:id="@+id/button"
/>
</LinearLayout>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:padding="30px" 定义各控件离边框的距离
tools:context=".MainActivity" >
<TextView
android:id="@+id/label" 为文字加入类内部
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点击我" />
<EditText
android:id="@+id/labol"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background" 定义背景颜色
android:layout_below="@id/label" layout below 在某某的下面 @id/label 此组键代表 TextView ,此文本定义在此组键的下边,
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/labol" 文字定义在文本框的下边
android:id="@+id/entry"
android:layout_alignParentRight="true" 定义在父界面的右边
android:layout_marginLeft="10px" 定义此组键左边的间距
android:text="OK"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/entry" 与组键Entry同高
android:layout_alignBottom="@+id/entry" 与组键同大小
android:layout_toLeftOf="@+id/entry" 在组建的左边
android:text="Concel" />
</RelativeLayout>
2.<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30px" 界面离实际内容距离
>
<RelativeLayout 嵌套相对布局
android:layout_width="fill_parent"
android:layout_height="wrap_content" 此时高度只能包裹内容的高度
>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入手机号码:"
android:layout_alignParentLeft="true" 定义在容器的左边
android:padding="20px" 间距20px
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/text" 定义在某某的右边
android:layout_alignLine="@id/text" 与button同一水平线
android:id="@+id/number"
/>
></RelativeLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入内容:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:id="@+id/content"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="发送"
android:id="@+id/button"
/>
</LinearLayout>
0 0
- 菜鸟相对布局笔记
- 菜鸟学android(1)线性布局与相对布局
- Android笔记---RelativeLayout相对布局
- Android布局RelativeLayout(相对布局)笔记
- Android学习笔记08:相对布局RelativeLayout
- Android学习笔记(14):相对布局RelativeLayout
- kshon学习笔记之android相对布局
- 安卓布局基础笔记(相对布局 -- RelativeLayout )
- Androidx学习笔记(7)--常见布局--相对布局
- 学习笔记4/5(相对布局 布局文件顺序问题
- 相对布局
- 相对布局
- 相对布局
- 相对布局
- 相对布局
- 相对布局
- 相对布局
- 相对布局
- hdu 1075 What Are You Talking About(字典树)
- <head first...>读书笔记
- ZOJ 1994Budget 有源汇上下界网络流 可行流
- 最近需要学习参考的网页链接
- github上传项目报src refspec master does not match any
- 菜鸟相对布局笔记
- 织梦开启错误提示方法
- java中this的使用
- 介绍——基于类的视图(class-based view)
- lcd_density
- SOAP协议和基于SOAP的开发流程详述
- xcode下git的使用
- MediaPlayer常见错误
- 生活杂篇,嘿,girl