android向导布局优化

《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>

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

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/53186.html

(0)
上一篇 2021年8月6日
下一篇 2021年8月6日

相关推荐

发表回复

登录后才能评论