Android百分比布局Eclipse项目

百分比布局的 Android 项目,适配起来真方便。项目自带PercentFrameLayoutPercentLinearLayoutPercentRelativeLayout三种常用布局,直接拿来用就行。样式属性都定义好了,styleable 那块也全,不用自己造轮子。

如果你还在手动计算宽高比例,嗯,真的可以试试它。Eclipse 项目结构也挺清晰,资源和代码分得明明白白。适合老项目或者维护老代码的场景,尤其是对还在用 Eclipse 的同学来说,蛮省事。

用起来也简单,比如你想要一个宽度是屏幕 80%的按钮:

<Button android:layout_width="0dp" app:layout_widthPercent="80%" android:layout_height="wrap_content" android:text="点我一下" />

哦对了,还有不少相关资源可以一起搭着看:

如果你项目还在用 Eclipse,或者想快速搭建一个能自适应分辨率的布局方案,这份源码蛮适合收藏。

zip
percent_lib.zip 预估大小:51个文件
folder
percent_lib 文件夹
file
.project 847B
folder
bin 文件夹
file
AndroidManifest.xml 888B
folder
res 文件夹
folder
classes 文件夹
folder
com 文件夹
folder
example 文件夹
folder
percent_lib 文件夹
file
R$string.class 487B
file
PercentFrameLayout$LayoutParams.class 3KB
file
R$layout.class 418B
file
PercentLayoutHelper$PercentLayoutInfo.class 4KB
file
MainActivity.class 527B
file
R$dimen.class 476B
file
R$drawable.class 422B
file
PercentRelativeLayout$LayoutParams.class 2KB
file
R$styleable.class 1KB
file
R$menu.class 403B
file
R.class 784B
file
PercentLayoutHelper$PercentLayoutParams.class 459B
file
PercentLinearLayout$LayoutParams.class 2KB
file
R$style.class 446B
file
BuildConfig.class 355B
file
PercentLinearLayout.class 3KB
file
R$attr.class 838B
file
PercentRelativeLayout.class 2KB
file
PercentFrameLayout.class 2KB
file
PercentLayoutHelper.class 7KB
file
R$id.class 408B
folder
.settings 文件夹
file
org.eclipse.jdt.core.prefs 177B
file
ic_launcher-web.png 50KB
file
AndroidManifest.xml 888B
file
proguard-project.txt 781B
folder
libs 文件夹
file
android-support-v4.jar 613KB
folder
src 文件夹
folder
com 文件夹
folder
example 文件夹
folder
percent_lib 文件夹
file
PercentLinearLayout.java 3KB
file
PercentRelativeLayout.java 5KB
file
PercentFrameLayout.java 5KB
file
PercentLayoutHelper.java 18KB
file
MainActivity.java 303B
file
project.properties 563B
folder
res 文件夹
folder
values 文件夹
file
attrs.xml 811B
file
styles.xml 160B
file
strings.xml 228B
file
dimens.xml 220B
folder
values-sw720dp-land 文件夹
file
dimens.xml 277B
folder
layout 文件夹
file
activity_main.xml 947B
folder
drawable-ldpi 文件夹
folder
drawable-hdpi 文件夹
file
ic_launcher.png 7KB
folder
values-v11 文件夹
file
styles.xml 334B
folder
drawable-mdpi 文件夹
file
ic_launcher.png 4KB
folder
values-sw600dp 文件夹
file
dimens.xml 203B
folder
drawable-xhdpi 文件夹
file
ic_launcher.png 12KB
folder
drawable-xxhdpi 文件夹
file
ic_launcher.png 24KB
folder
menu 文件夹
file
main.xml 263B
folder
values-v14 文件夹
file
styles.xml 391B
file
.classpath 475B
folder
gen 文件夹
folder
com 文件夹
folder
example 文件夹
folder
percent_lib 文件夹
file
R.java 19KB
file
BuildConfig.java 165B
folder
assets 文件夹
...
zip 文件大小:671.3KB