我有一個ListView這裏OnItemClick不工作是其行佈局如果滾動型的佈局
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="280dp">
<ScrollView
android:scrollbars="none"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/exploreImage"
android:src="@drawable/beard1"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
<TextView
android:id="@+id/exploreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
我在我的佈局來實現滾動型,說明here。
所以,我的麻煩是OnItemClickListener,我設置爲listView不起作用。我可以實現OnTouchListener,但在這種情況下,我需要知道點擊項目的位置和ID。
UPD1:我的listView的代碼。 這
<ListView
android:id="@+id/exploreList"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
UPD2:我不需要這個滾動滾動型,只有ListView控件。另外我想讓OnItemClickListener工作。
任何想法? 謝謝。
你在哪裏有你的listview?我沒有看到一個列表視圖! – WarrenFaith
@WarrenFaith我展示了我的行layot的代碼,我的ListView代碼的代碼會幫助嗎? Oo –
假設你想檢測列表中被點擊的項目爲什麼不使用onListItemClick?如果你不想檢測被點擊的列表項,那麼我不明白你的問題。 – pedromss