andriod中的布局

在开发中,组件的布局是大家每天都要面对的工作,对于android的五中常用的布局,分别为:

linearlayout线性布局

tableLayout表格布局

Relativelayout相对布局

absoluteLayout绝对布局

framelayout 框架布局

但是在开发中可以按照百分比的方式进行界面布局,将会对我们的适配工作带来许多便利

PercentRelativeLayout

 自定义百分比相对布局

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        app:layout_heightPrecent="0.2"
        app:layout_widthPrecent="0.2"
        android:background="#28FF28"
        android:text="http://blog.youkuaiyun.com/mynameishuangshuai" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        app:layout_heightPrecent="0.3"
        app:layout_widthPrecent="0.3"
        android:background="#28FF28"
        android:text=1111" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:layout_heightPrecent="0.2"
        app:layout_widthPrecent="0.2"
        android:background="#28FF28"
        android:text="castiel" />
 



 如图可自定义权重的高度,来进行界面的分配




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值