Android布局方式(AbsoluteLayout)学习
2012-12-25 14:09
489 查看
AbsoluteLayout 可以让子元素指定准确的x/y坐标值,并显示在屏幕上。(0, 0) 为左上角,当向下或向右移动时,
坐标值将变大 AbsoluteLayout 没有页边框,允许元素之间互相重叠.这种布局方式不推荐使用,刚性太强,在不同的界面上
的效果会不同.
代码演示:
<AbsoluteLayout 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"
tools:context=".MainActivity"
android:background="@color/bgcolor" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"
android:textColor="@color/white"
android:textSize="22sp"
android:typeface="monospace"
android:layout_x="40dip"
android:layout_y="60dip"
/>
<EditText
android:width="160dip"
android:height="35dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="120dip"
android:layout_y="60dip"
android:textColor="@color/gray"
android:scrollHorizontally="false"
android:background="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"
android:textColor="@color/white"
android:textSize="22sp"
android:typeface="monospace"
android:layout_x="40dip"
android:layout_y="100dip"
/>
<EditText
android:width="160dip"
android:height="35dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="120dip"
android:layout_y="100dip"
android:password="true"
android:textColor="@color/gray"
android:scrollHorizontally="false"
android:background="@color/white"/>
<Button
android:text="登录"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_x="130dip"
android:layout_y="140dip"/>
<Button
android:text="注册"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_x="200dip"
android:layout_y="140dip"/>
</AbsoluteLayout> 截图:
相关文章推荐
- Android布局方式(AbsoluteLayout)学习
- Android--布局方式(RelativeLayout)学习
- Android--布局方式(RelativeLayout)学习
- Android中常用的五种布局方式:AbsoluteLayout
- android学习--Android五大布局对象---FrameLayout,LinearLayout,AbsoluteLayout,RelativeLayout,TableLayout.
- Android学习(十四)五布局之绝对布局AbsoluteLayout
- Android学习-五布局之绝对布局(AbsoluteLayout)
- Android布局方式(TableLayout)学习
- Android学习第四天之AbsoluteLayout绝对布局
- Android--布局方式(LinearLayout)学习
- Android布局方式(TableLayout)学习
- Android--布局方式(LinearLayout)学习
- Android学习系列(二)布局管理器之线性布局的3种实现方式
- android控件学习二:使用LayoutInflater动态加载布局和操作控件
- Android 布局学习之——LinearLayout的layout_weight属性
- android学习:关于RelativeLayout叠放布局的问题
- Android AbsoluteLayout布局(绝对布局)
- android 学习Layout布局的使用
- Android开发学习笔记:5大布局方式详解
- android学习之布局(layout)