【问题标题】:Master Detail columns disappear after including toolbar in layout在布局中包含工具栏后,主详细信息列消失
【发布时间】:2017-08-16 14:10:37
【问题描述】:

在主从布局中包含工具栏后,主从列(以及垂直分隔线)由于某种原因消失了。为了解决这个问题需要做什么?

<?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="match_parent"
    android:orientation="horizontal"
    android:divider="@drawable/divider_vertical"
    android:showDividers="middle"
    android:baselineAligned="false">

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

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:id="@+id/master_container"/>

    <FrameLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="3"
        android:id="@+id/detail_container"/>

</LinearLayout>

【问题讨论】:

    标签: android xml android-toolbar master-detail


    【解决方案1】:

    试试这个:

    <?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="match_parent"
        android:orientation="vertical">
    
        <include layout="@layout/myToolbar"/>
    
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:baselineAligned="false"
            android:divider="@drawable/divider_vertical"
            android:orientation="horizontal"
            android:showDividers="middle">
    
            <RelativeLayout
                android:id="@+id/master_container"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"/>
    
            <FrameLayout
                android:id="@+id/detail_container"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="3"/>
    
        </LinearLayout>
    
    </LinearLayout>
    

    【讨论】:

    • 完美!非常感谢:-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-06
    • 2016-09-22
    相关资源
    最近更新 更多