Isma9
Isma9

Reputation: 659

Toolbar overlapping listView

My toolbar it's overlooping the list view.

Toolbar.xml

<?xml version="1.0" encoding="utf-8"?>

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorAccent"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />

View.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ismael.fisiopia.views.TratamientosActivity">

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


        <ListView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/tratamientoview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

        </ListView>

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/btnAddTrat"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end|bottom"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="36dp"
            android:layout_marginRight="36dp"
            android:clickable="true" />


    <RelativeLayout
        android:id="@+id/progressLayoutTrat"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#B0000000"
        android:visibility="gone">

        <ProgressBar
            android:id="@+id/progressBarTratamientos"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="13dp"
            android:layout_marginStart="13dp"
            android:paddingTop="250dp"
            android:visibility="gone" />

    </RelativeLayout>
</RelativeLayout>

I tried to put this line: app:layout_behavior="@string/appbar_scrolling_view_behavior" But not works

I have one progressbar too into one relativeLayout because i need to change the background color when some operations are calculating into de app.

Could you help me? Thanks :)

Upvotes: 0

Views: 796

Answers (2)

Amit Kumar
Amit Kumar

Reputation: 547

  1. Replace Root RelativeLayout by CoordinatorLayout

  2. Add parent AppBarLayout to Toolbar

  3. Add scrolling behaviour to your ListView

Upvotes: 3

Dithesh
Dithesh

Reputation: 9

The Popup theme in toolbar is wrong replace this

app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" 

into this

app:popupTheme="@style/AppTheme.PopupOverlay"

Upvotes: 0

Related Questions