java格子布局怎么设置高度_java – 将相对布局中的宽度和高度设置为百分比
发布日期:2021-06-24 16:33:38 浏览次数:3 分类:技术文章

本文共 1284 字,大约阅读时间需要 4 分钟。

我想这样:一个由2个箭头覆盖的ViewPager

我得到了我想要的代码.但是,我得到了lint的这些警告:

>这种布局没用(对于虚拟布局)

>嵌套权重对性能不利.

我想知道是否有更好的方法来获得我想要的UI.

android:layout_width="match_parent"

android:layout_height="match_parent" >

android:id="@+id/dialog_instruction_pager"

android:layout_width="wrap_content"

android:layout_height="wrap_content" >

android:layout_width="match_parent"

android:layout_height="match_parent"

android:gravity="center"

android:orientation="vertical" >

android:layout_width="match_parent"

android:layout_height="0dp"

android:layout_weight=".2"

android:orientation="horizontal" >

android:id="@+id/instruction_dialog_left_arrow"

android:layout_width="0dp"

android:layout_height="match_parent"

android:layout_weight=".05"

android:background="?android:attr/selectableItemBackground"

android:scaleType="fitCenter"

android:src="@drawable/arrow_left_grey" />

android:layout_width="0dp"

android:layout_height="match_parent"

android:layout_weight=".8" >

android:id="@+id/instruction_dialog_right_arrow"

android:layout_width="0dp"

android:layout_height="match_parent"

android:layout_weight=".05"

android:background="?android:attr/selectableItemBackground"

android:scaleType="fitCenter"

android:src="@drawable/arrow_right_grey" />

P.S:是否有任何布局允许对齐左边,右边,底部(如RelativeLayout),还允许设置宽度,高度为百分比(如LinearLayout中的“weight”属性)?

谢谢 !

转载地址:https://blog.csdn.net/weixin_33865450/article/details/114729091 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:mach空串 php preg_python模式匹配与正则表达式
下一篇:java 字符拼接效率_Java 5种字符串拼接方式性能比较。

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月04日 11时19分54秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章