Android百分比布局支持库 com.android.support:percent
来源:互联网 发布:域名访问升级访问 编辑:程序博客网 时间:2024/05/17 08:09
要想在Android中使用百分比进行布局,首先要导入library. com.android.support:percent
使用方法介绍:
百分比控件布局分为两种:PercentFrameLayout 和 PercentRelativeLayout
顾名思义都是继承了FrameLayou和RelativeLayout
从源码中可以看出,百分比类库支持的属性有如下这些
<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="PercentLayout_Layout"> <attr name="layout_widthPercent" format="fraction"/> <attr name="layout_heightPercent" format="fraction"/> <attr name="layout_marginPercent" format="fraction"/> <attr name="layout_marginLeftPercent" format="fraction"/> <attr name="layout_marginTopPercent" format="fraction"/> <attr name="layout_marginRightPercent" format="fraction"/> <attr name="layout_marginBottomPercent" format="fraction"/> <attr name="layout_marginStartPercent" format="fraction"/> <attr name="layout_marginEndPercent" format="fraction"/> </declare-styleable></resources>
使用方法举例:
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_height="match_parent" > <View android:layout_width="0dp" android:layout_height="0dp" app:layout_widthPercent="50%" app:layout_heightPercent="50%" android:background="#FF4C4B" android:text="@string/hello_world" /></android.support.percent.PercentRelativeLayout>
首先要引入
xmlns:app="http://schemas.android.com/apk/res-auto"
然后在想要使用百分比的控件中使用上述属性进行编写
0 0
- Android百分比布局支持库 com.android.support:percent
- Android百分比布局支持库(android-percent-support)
- 简述Android 百分比布局支持库(android-percent-support)
- Android百分比布局支持库介绍——com.android.support:percent
- Android百分比布局支持库介绍——com.android.support:percent
- Android百分比布局支持库介绍——com.android.support:percent
- Android百分比布局支持库介绍——com.android.support:percent
- Android百分比布局支持库——com.android.support:percent
- Android百分比布局支持库介绍——com.android.support:percent
- Android 百分比支持库 android-percent-support
- Android--百分比布局库(percent-support-lib)
- Android 百分比布局库(percent-support-lib)
- Android 百分比布局库(percent-support-lib)
- Android Support库百分比布局 com.android.support:percent:22.2.0 附带Eclipse教程
- Android百分比布局Percent支持库
- Android百分比布局Percent支持库
- Android 百分比布局(Percent Support Library)
- Android百分比布局(percent-support-lib)
- HDU 3328 Flipper 魔术纸牌
- 最小二乘回归树生成算法
- 有关c语言的++与--
- ecshop 资料整理
- GTK入门学习:布局容器之表格布局
- Android百分比布局支持库 com.android.support:percent
- QQList列表功能实现
- Fedora20上Xen的安装与部署
- 如何建设一个高性能网站
- Chrome明文存储密码
- Hidden String(模拟)
- S5PV210开发系列七_Nand驱动实现
- 头尾式动画
- C++ 智能指针的简单实现