1
所以我試着在這篇文章中的解決方案:Spotify ListView header image effect在我目前正在開發的應用程序中。將點擊事件發送到ParallaxScrollView中的背景視圖
除了一個小問題,一切正常,我無法讓背景視圖處理點擊。這裏就是我的意思詳細
實現視差效果活性的佈局如下:
<ParallaxScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parallaxScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?white">
<LinearLayout
android:id="@+id/parallaxScrollViewBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@color/yellow" />
<include
android:layout_width="match_parent"
android:layout_height="48dp"
layout="@layout/layout1" />
<include layout="@layout/layout2" />
<include layout="@layout/layout3" />
<include layout="@layout/layout4" />
<include layout="@layout/layout5" />
</LinearLayout>
<ParallaxLinearLayout
android:id="@+id/parallaxScrollViewForeground"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/llMainHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/content_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?white"
android:divider="@android:color/transparent"
android:dividerHeight="20dp"
android:cacheColorHint="#00000000"
android:listSelector="@android:color/transparent"
android:overScrollMode="never"
android:scrollbars="none" />
</LinearLayout>
</LinearLayout>
</ParallaxLinearLayout>
</ParallaxScrollView>
的ParallaxLinearLayout是在我前面提到的答案提出的解決方案一樣AnotherView。
正如您所見,parallaxScrollViewBackground包含許多佈局。這些佈局應該處理一些點擊事件。然而,前景(ParallaxLinearLayout)實際上是接收和處理點擊的位置(我通過調試器檢查並帶有一些記錄幫助)。
所以我的問題:有沒有辦法將點擊事件發送到我的當前設置的背景視圖?如果不是,我願意接受建議。
感謝
我感謝您的幫助,但不幸的是,這並沒有幫助。非常感謝。 – Fred