0

мой XML:Activity, охватывающей панель инструментов

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

моя панель работает отлично на апи 21 и выше из-за Elevation но на апи < 20 крытыми элементом Activity (в так что они не поддерживают повышение), любая идея как это исправить?

здесь вы можете увидеть, что моя панель находится позади cardview enter image description here

ответ

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

спасибо за ответ человека, его работу, но я хочу, чтобы наложить содержание, прямо сейчас другие мои содержание ниже в панели инструментов, я хочу накладывать другое содержимое на мою панель инструментов, потому что я делаю видимым и прозрачным в соответствии с прокруткой RecyclerView –

+0

, вы говорите, что хотите скрыть/показать свою панель инструментов в отношении прокрутки вашего вида ресайклера? – Harry

+0

no Я уже делаю это, см. Этот https://raw.githubusercontent.com/kanytu/android-parallax-recycleview/master/screenshots/parallaxtoolbar.gif вот так –

Смежные вопросы