(九)8天快速掌握Android视频教程_深入了解各种布局技术

布局介绍:
Linearlayout(线性布局)、RelativetLayout(相对布局)、
TableLayout(表格布局)、FrameLayout(帧布局)


padding(内间距)指的是控件和周边四个方向的距离。


@android:drawable/editbox_background用来指定系统的android的文件夹的R文件的内容。
在设置大的背景的时候可以选择自己喜欢的照片就行显示。


作为根元素肯定有一个命名空间。
在布局文件中要想设置布局的背景直接输入#加六位RGB值就可以了。


padding指的是该控件离周边四条边的距离都是它设置的值。也就是内 间距。


在使用背景图片的时候可以使用开发者自己放进去的背景资源,也可以使用安卓系统自带的资源,使用的时候是这样使用的:@android:drawable:/editbox_background
安卓自带的drawable里面的资源。


layout_below在什么什么的下面。
alignParentRight对齐父元素的右边。
marginLeft控件与控件之间的距离。
toLeftOf在什么什么的左边。
alignTop和什么什么的上边对齐。


relativelayout事例


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


    <RelativeLayout
        android:id="@+id/relaylayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp">


        <TextView
            android:id="@+id/textNum"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:height="35dp"
            android:text="请输入手机号"
            android:textSize="20sp" />


        <EditText
            android:id="@+id/editNum"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/textNum"
            android:layout_alignParentRight="true"
            android:hint="18700000000" />
    </RelativeLayout>


    <TextView
        android:id="@+id/textContent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/relaylayout"
        android:textSize="20sp"
        android:text="请输入短信内容" />


    <EditText
        android:id="@+id/editContent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/textContent"
        android:minLines="3" />


    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/editContent"
        android:digits="@+id/btnSend"
        android:textSize="20sp"
        android:text="发送短信" />


</RelativeLayout>






tablelayout事例


<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1" >


    <TableRow>


        <TextView
            android:padding="3dp"
            android:text="1" />


        <TextView
            android:padding="3dp"
            android:text="2" />
    </TableRow>


    <TableRow>


        <TextView
            android:padding="3dp"
            android:text="3" />


        <TextView
            android:padding="3dp"
            android:text="4" />
    </TableRow>


</TableLayout>


FrameLayout简单介绍


它们之间是叠加的关系。
是一层上面叠加一层,第二层可以盖住第一层。
例如在看电视看电影的时候上面的暂停按钮就是叠加在电视或者电影画面上的。
做游戏的时候也会用到,几个画面叠加到了一起。

















评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值