首页 文章

如何在操作栏和其下方的布局之间添加水平分隔线

提问于
浏览
-1

如何添加分隔符以使其显示在操作栏下方和主/明细窗格上方?我已经定义了垂直分频器,但也不知道如何定义水平分频器 .

<LinearLayout 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:orientation="horizontal"
    android:divider="@drawable/divider_vertical"
    android:showDividers="middle"
    android:baselineAligned="false"
    tools:context=".MainActivity" >

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

divider_vertical.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <size android:width="1dp"/>
    <solid android:color="#FFFFFF"/>
</shape>

divider_horizontal.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <size android:height="1dp"/>
    <solid android:color="#FFFFFF"/>
</shape>

enter image description here

1 回答

  • 1

    我没有看到工具栏的代码,所以在我看来,工具栏下面应该有一个视图,如下所示 . 我使用过材质设计工具栏,你可以使用任何工具栏 .

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:theme="@style/Base.ThemeOverlay.AppCompat.Dark">
    
    </android.support.v7.widget.Toolbar>
                <View android:layout_height="0dp"
                      android:layout_width="fill_parent"
                      android:id="@+id/stripBelowToolbar"/>
    

相关问题