首页 编程技术android向导布局优化

android向导布局优化

运维派隶属马哥教育旗下专业运维社区,是国内成立最早的IT运维技术社区,欢迎关注公众号:yunweipai
领取学习更多免费Linux云计算、Python、Docker、K8s教程关注公众号:马哥linux运维

《Android向导框架(Wizard framework)的一种实现》文章中我们谈到了android向导的实现方式,之前遗留了一个问题,向导按钮与页面内容重叠,在Map那个页面特别明显。
这个问题现在有解决方法了,其实很简单,是布局有点问题。
之前使用的是RelativeLayout,然后属性都是fill_parent,因此就重叠了。
现在将布局调整为LinerLayout,并使用
android:weightSum属性。将底部的按钮权重设置为0.1,页面设置为0.9,就是下面效果。
wpid-iSight-2013-01-6-07-55.tiffwpid-1__@__iSight-2013-01-6-07-55.tiffwpid-2__@__iSight-2013-01-6-07-55.tiff
布局文件
<?xml version=“1.0” encoding=“utf-8”?>
<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:weightSum=“1.0”
android:orientation=“vertical” >

<FrameLayout
android:id=“@+id/wizard_content”
android:layout_width=“fill_parent”
android:layout_height=“0dp”
android:layout_weight=“0.90”>
</FrameLayout>

<LinearLayout
xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“fill_parent”
android:layout_height=“0dp”
android:layout_weight=“0.10”
android:orientation=“horizontal” >

<Button
android:id=“@+id/wizard_previous_btn”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Previous” />

<Button
android:id=“@+id/wizard_next_btn”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Next” />

<Button
android:id=“@+id/wizard_finish_btn”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Finish” />

</LinearLayout>

</LinearLayout>

本文链接:https://www.yunweipai.com/2533.html

网友评论comments

发表回复

您的电子邮箱地址不会被公开。

暂无评论

Copyright © 2012-2022 YUNWEIPAI.COM - 运维派 京ICP备16064699号-6
扫二维码
扫二维码
返回顶部