2017-07-14 58 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