【发布时间】:2015-09-04 11:51:24
【问题描述】:
似乎新的百分比支持库发布时不允许在维度 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"/>
<ImageView
app:layout_widthPercent="50%"
app:layout_heightPercent="50%"
app:layout_marginTopPercent="25%"
app:layout_marginLeftPercent="25%"/>
</android.support.percent.PercentFrameLayout/>
能够编写类似的代码:
<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"/>
<ImageView
app:layout_widthPercent="@percent/myWidthPercent"
app:layout_heightPercent="@percent/my/HeightPercent"
app:layout_marginTopPercent="@percent/myMarginTophPercent"
app:layout_marginLeftPercent="@percent/myMarginLeftPercent"/>
myWidthPercent 在资源文件中定义。
我错了(我是不是用另一个名字错过了它)还是我们可以发送给谷歌的功能请求?
【问题讨论】:
-
你如何使用这个标签,因为我在第一行出现错误
标签: android android-resources android-percent-library