0

meine XML:Aktivität des Elements abdeckt Toolbar

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical"> 

<ProgressBar 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/progressBar" 
    android:layout_gravity="center_horizontal|top" 
    android:layout_marginTop="50dp" 
    android:indeterminate="true" 
    android:visibility="invisible" 
    android:layout_centerHorizontal="true" /> 

    <android.support.v7.widget.Toolbar 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:minHeight="?attr/actionBarSize" 
     android:id="@+id/toolbarTab2" 
     app:theme="@style/ToolBarStyle" 
     android:elevation="5dp" 
     android:paddingTop="20dp" 
     android:textAlignment="center" 
     android:background="@android:color/holo_red_light"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="MY TOOLBAR TITLE" 
      android:layout_gravity="center" 
      android:id="@+id/toolbar_title" 
      android:textSize="20sp" 
      android:textStyle="bold" 
      android:background="#00000000" 
      android:textColor="#ffffff" /> 

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


    <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/swipe_refresh_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:foregroundGravity="left|right"> 




    <android.support.v7.widget.RecyclerView 

     android:id="@+id/notesList" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 

     > 

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


</android.support.v4.widget.SwipeRefreshLayout> 

</RelativeLayout> 

meiner Symbolleiste auf api 21 arbeitet gut und höher wegen Elevation aber auf api < 20 seine abgedeckt durch Aktivität des Elements (da sie unterstützen nicht Elevation), eine Idee wie das zu beheben ??

hier kann man sehen, dass mein Toolbar hinter dem cardview enter image description here

Antwort

1
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical"> 

<ProgressBar 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/progressBar" 
    android:layout_gravity="center_horizontal|top" 
    android:layout_marginTop="50dp" 
    android:indeterminate="true" 
    android:visibility="invisible" 
    android:layout_centerHorizontal="true" /> 

<android.support.v7.widget.Toolbar 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:minHeight="?attr/actionBarSize" 
    android:id="@+id/toolbarTab2" 
    app:theme="@style/ToolBarStyle" 
    android:elevation="5dp" 
    android:paddingTop="20dp" 
    android:textAlignment="center" 
    android:background="@android:color/holo_red_light"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="MY TOOLBAR TITLE" 
     android:layout_gravity="center" 
     android:id="@+id/toolbar_title" 
     android:textSize="20sp" 
     android:textStyle="bold" 
     android:background="#00000000" 
     android:textColor="#ffffff" /> 

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


<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/swipe_refresh_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingTop="?attr/actionBarSize" 
    android:clipToPadding="false" 
    android:clipChildren="false" 
    android:foregroundGravity="left|right"> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/notesList" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 

    > 

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


</android.support.v4.widget.SwipeRefreshLayout> 

</RelativeLayout> 
+0

Dank für die Beantwortung eines Mannes, der Arbeits ist, aber ich mag Inhalt zu überlagern, gerade jetzt meine andere Inhalte unter der Symbolleiste sind, mag ich Overlay anderer Inhalte mit meiner Toolbar, weil ich sichtbar und transparent mache nach Scroll von RecyclerView –

+0

sagst du, dass du deine Toolbar in Bezug auf die Schriftrolle deiner Recycleransicht verstecken/anzeigen willst? – Harry

+0

nein, ich mache das schon https://raw.githubusercontent.com/kanytu/android-parallax-recycleview/master/screenshots/parallaxtoolbar.gif wie diese –