2017-07-14 55 views
0

我已將回收站視圖滾動到工具欄的頂部,但工具欄項(例如,主頁按鈕)不可點擊。如何使查看下可查看點擊?

我的佈局:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/primary"> 

    <include 
     android:id="@id/toolbar_feed" 
     layout="@layout/toolbar_feed"/> 
    // Inside viewPager is recycler view which scroll over the toolbar 
    <android.support.v4.view.ViewPager 
     android:id="@+id/view_pager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <include 
     android:id="@+id/navigation_bottom_layout" 
     layout="@layout/bottom_navigation_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"/> 

</RelativeLayout> 

我唯一的問題是,工具欄主頁按鈕無法點擊,因爲它的背後viewPager層。它可以與播放轉換Z一起工作,但它只支持API21 +。那麼,你們有想法做這個工作?

+0

你試過android:clickable =「true」嗎? – Konrad

+0

@okset是的,它沒有工作。 – Hype

+0

你可以發佈整個XML佈局嗎? – kws

回答

-1

更改在父級中添加視圖的順序。

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/primary"> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/view_pager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

    <include 
     android:id="@id/toolbar_feed" 
     layout="@layout/toolbar_feed"/> 

    <include 
     android:id="@+id/navigation_bottom_layout" 
     layout="@layout/bottom_navigation_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"/> 

</RelativeLayout> 
+0

這不是我的用例的解決方案。我需要在工具欄上滾動的回收站。在你的例子中,點擊攔截將會很好,但工具欄將會覆蓋我的回收站視圖。 – Hype

+0

你提到過一個RecyclerView,但是我沒有看到它在你的佈局的任何地方。如果沒有發佈與您的問題xml文件相關的所有問題,則很難提出解決方案。 – kws

+0

對不起,編輯問題之前有一個評論,我解釋說,在viewpager是回收者視圖。 – Hype