您的位置:首页 > 移动开发 > Android开发

android Merger 代替 FrameLayout:布局优化

2016-06-24 22:12 453 查看
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="80dp"/>
<include layout="@layout/view_toolbar_with_indicator"/>

</FrameLayout>
图1 的布局


<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="?actionBarSize"/>

<include layout="@layout/view_toolbar_with_indicator"/>

</merge>
图2的布局

merge比framelayout的少一个framelayout的节点



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: