Android界面百分比适配-PercentRelativeLayout
来源:互联网 发布:全球电视直播软件apk 编辑:程序博客网 时间:2024/05/17 22:03
在使用PercentRelativeLayout前我们需要现在build.gradle里添加上
compile 'com.android.support:percent:22.2.0'来添加支持库。
然后实现main.xml:
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"><TextViewandroid:background="#ffffeeff"android:text="1"android:id="@+id/a" android:gravity="center"app:layout_heightPercent="10%"app:layout_widthPercent="100%"app:layout_marginBottomPercent="5%"/> <TextViewandroid:background="#ffbbff00"android:text="2"android:id="@+id/b"android:gravity="center"android:layout_below="@+id/a" app:layout_heightPercent="10%"app:layout_widthPercent="10%"app:layout_marginBottomPercent="5%"/><TextViewandroid:background="#ff0ff0ff"android:text="3"android:id="@+id/c"android:gravity="center"android:layout_below="@+id/b" app:layout_heightPercent="10%"app:layout_widthPercent="20%" app:layout_marginBottomPercent="10%"/><TextViewandroid:background="#fffdd000"android:text="4"android:id="@+id/d"android:gravity="center"android:layout_below="@+id/c"app:layout_heightPercent="10%"app:layout_widthPercent="30%"app:layout_marginBottomPercent="20%"/><TextViewandroid:background="#ff0000ff"android:text="5"android:gravity="center"android:layout_below="@+id/d"app:layout_heightPercent="10%"app:layout_widthPercent="40%"/></android.support.percent.PercentRelativeLayout>使用android:layout_below="@+id/d"这类语句控制某两个控件间的位置关系。
app:layout_heightPercent="10%"app:layout_widthPercent="30%"app:layout_marginBottomPercent="20%"
这三句分别控制控件宽、长和两控件间隔占手机屏幕的百分比。
效果图:
阅读全文
0 0
- Android界面百分比适配-PercentRelativeLayout
- Android百分比布局:PercentRelativeLayout
- Android百分比布局:PercentRelativeLayout
- android百分比布局PercentRelativeLayout
- android 百分比布局percentFrameLayout,percentRelativeLayout的使用
- 百分比布局PercentRelativeLayout
- PercentRelativeLayout百分比布局
- Android PercentRelativeLayout
- android 5.0+原生质设计,cardview、Recyclerview、百分比布局PercentRelativeLayout简单使用
- android 百分比适配
- Android百分比适配
- Android百分比适配
- 百分比布局(PercentFrameLayout和PercentRelativeLayout)
- PercentRelativeLayout
- Android屏幕适配,百分比布局
- Android屏幕适配,百分比布局
- android百分比布局学习,适配相关
- 关于android中的百分比适配
- 使用DOM编程实现省市联动
- 生成式对抗网络Generative Adversarial Networks(GANs)
- StretchDIBits显示8位图问题
- JavaScript---Object.defineProperty()与两种属性描述符简介->数据\存取描述符
- java IO流
- Android界面百分比适配-PercentRelativeLayout
- 第一次实现单层神经网络
- hdu_6186_前缀后缀_水_死于英语
- Activity的启动模式
- ActiveMQ笔记——技术点汇总
- 最全Pycharm教程(18)——Pycharm编辑器功能之代码拼写提示
- LeetCode
- 设计模式 ----- 策略模式
- irst-missing-positive