在开发中,组件的布局是大家每天都要面对的工作,对于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.csdn.net/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" /> 如图可自定义权重的高度,来进行界面的分配