【发布时间】:2016-10-04 08:16:51
【问题描述】:
我目前正在使用 android.support.percent API
我的示例代码
<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"/>
<TextView
android:text="Completed"
app:layout_widthPercent="40%"
app:layout_heightPercent="40%"
app:layout_marginTopPercent="15%"
app:layout_marginLeftPercent="15%"/>
</android.support.percent.PercentRelativeLayout/>
我的问题:
百分比相对布局在平板电脑中正确显示...但有些视图在手机中显示非常小。
所以我只想增加手机的百分比。而不是平板电脑。
我的问题:
如何使用百分比相对布局为手机和平板电脑设置不同的百分比。(如不同的尺寸)
app:layout_heightPercent="40%" // 适合平板电脑 但我想提高到 50% 的电话..
【问题讨论】:
-
像往常一样...将值存储在大小依赖资源中
-
@Selvin 很棘手.. 它的 %.. 不是字符串或 DP.. 所以我很困惑。
-
它是
fraction -
谢谢.. 看来我的问题已经解决了
标签: android android-layout android-percent-layout