FrameLayout中View的背面可以点击

时间:2015-01-30 06:56:53

标签: android

我制作了视差效果示例应用,就像google-play。

<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <ImageView
    android:id="@+id/headerImage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    android:clickable="true"/>

  <android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?attr/actionBarSize"
    android:clipToPadding="false"
    android:clickable="false"/>

  <include
    layout="@layout/common_toolbar"/>
</FrameLayout>

我的布局图层如下所示

front side
        --- : ToolBar, 
----------- : RecyclerView, scrolling normally, padding dynamically as header height 
    ------- : header image, scrolling slowly
back side

视差效果正常,但我想让标题可点击, 但我不能,因为RecyclerView背后的标题。

如何使此标题可点击?

修改

简单的示例应用程序推送到repos下面。

https://github.com/sis-yoshiday/ParallaxExample

1 个答案:

答案 0 :(得分:0)

在java文件中:

添加以下行:headerimage.bringToFront();

set OnClickListener()