Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove divider between Toolbar and RelativeLayout

I have RelativeLayout below android.support.v7.widget.Toolbar. They both have the same color. How can I get rid of devider between them? enter image description here Here is xml code:

 <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:background="@color/HomeColorPrimary"
        android:minHeight="?attr/actionBarSize"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
    </android.support.v7.widget.Toolbar>

    <RelativeLayout
        android:layout_below="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:id="@+id/spaceBelowToolbar"
        android:background="@color/HomeColorPrimary"
        android:orientation="vertical"
        android:elevation="4dp">
    </RelativeLayout>

Here is the full xml file :

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/mainBody"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/MainBG">


    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:background="@color/HomeColorPrimary"
        android:minHeight="?attr/actionBarSize"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
    </android.support.v7.widget.Toolbar>

    <RelativeLayout
        android:layout_below="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:id="@+id/spaceBelowToolbar"
        android:background="@color/HomeColorPrimary"
        android:orientation="vertical"
        android:elevation="4dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="42dp"
            android:layout_alignParentLeft="true"
            android:id="@+id/MoneyValue"
            android:textColor="@color/md_white_1000"
            android:textSize="45sp"
            android:text="$850"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/MoneyValue"
            android:id="@+id/Balance"
            android:layout_marginLeft="42dp"
            android:textSize="25sp"
            android:textColor="@color/md_grey_300"
            android:text="BALANCE"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="180dp"
            android:id="@+id/PercentageValue"
            android:textColor="@color/md_white_1000"
            android:textSize="45sp"
            android:text="93%"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/PercentageValue"
            android:textColor="@color/md_grey_300"
            android:id="@+id/Budget"
            android:layout_marginLeft="180dp"
            android:textSize="25sp"
            android:text="BUDGET"/>

    </RelativeLayout>
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listViewLayout"
        android:layout_below="@+id/spaceBelowToolbar"
        >
        <ExpandableListView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp">


    <com.github.clans.fab.FloatingActionMenu
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="15dp"
        android:layout_marginBottom="30dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        fab:menu_labels_style="@style/MenuLabelsStyle"
        fab:menu_labels_showAnimation="@anim/jump_from_down"
        fab:menu_labels_hideAnimation="@anim/jump_to_down"
        fab:menu_animationDelayPerItem="0"
        fab:menu_shadowColor="#444"
        fab:menu_colorNormal="#FFB805"
        fab:menu_colorPressed="#F2AB00"
        fab:menu_colorRipple="#D99200">

    </com.github.clans.fab.FloatingActionMenu>
    </RelativeLayout>

</RelativeLayout>
</RelativeLayout>
like image 320
Zhambul Avatar asked Jun 20 '15 07:06

Zhambul


1 Answers

The most concise answer and easiest for me was applying it like so based on the comment. However, Since I have my toolbar wrapped by an app overlay I had to apply it to the AppBarLayout widget for it to work.

<!--takes away line with app elevation set to 0 -->
    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:elevation="0dp">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@drawable/email_bg"
            app:popupTheme="@style/AppTheme.PopupOverlay">

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.AppBarLayout>
like image 159
Lion789 Avatar answered Oct 13 '22 11:10

Lion789