/ एक स्क्रॉल दृश्य धारण करने वाली सूची दृश्य प्राप्त नहीं करेगा

ScrollView धारण करने वाली ListView OnItemClickEvent प्राप्त नहीं करेगा - एंड्रॉइड, सूचीदृश्य, स्क्रॉलव्यू, onitemclicklistener

मेरे पास एक सूची दृश्य है जहां प्रत्येक आइटम में अधिक तत्वों के बगल में स्क्रॉल दृश्य है (स्क्रॉलव्यू संपूर्ण आइटम सामग्री को लपेटता नहीं है):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/zuzu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/tztz"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<LinearLayout
android:id="@+id/rtrt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<ImageView
android:id="@+id/erer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout

<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<LinearLayout
android:id="@+id/wewe"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:orientation="vertical" >

<TextView
android:id="@+id/qwqw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"/>
</LinearLayout>

</ScrollView>
</LinearLayout>

</LinearLayout>

इस कॉन्फ़िगरेशन के साथ, मेरी ListActivity onItemClickListener को तब नहीं बुलाया जाता है जब मैं किसी आइटम पर क्लिक करता हूं:

getListView().setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
...
}
});

रैपिंग स्क्रॉल को हटाने के बाद, OnItemClickListener को उम्मीद के मुताबिक कहा जाता है।

मैं एक स्क्रॉलव्यू में लिनियरलैट को लपेटता हूं क्योंकि मुझे स्क्रॉलबार की आवश्यकता होती है यदि अंतर्निहित लेआउट में बहुत सारे तत्व हैं, जो प्रोग्रामेटिक रूप से जोड़े जाते हैं।

उत्तर:

जवाब के लिए 0 № 1

सबसे पहले, यकीन नहीं है कि एक स्क्रॉल में स्क्रॉल सबसे अच्छा हैउपाय। आंतरिक स्क्रॉल दृश्य स्पर्श ईवेंट को कैप्चर करता है, इसलिए "लिस्ट व्यू नॉट" टी को ईवेंट मिलता है, यदि आप इसे बिल्कुल इस तरह से करना चाहते हैं, तो आपको प्रेक्षक को लागू करने और लिस्ट देखने की आवश्यकता होगी


जवाब के लिए 0 № 2

ListView निश्चित गाइड ListView की दुनिया। Google I / O 2010 में एक बात।

एक महत्वपूर्ण बिंदु जो लगातार गूँज रहा थायह है कि सूची दृश्य में स्क्रॉल दृश्य या स्क्रॉल दृश्य में सूची दृश्य एक बुरा विचार है। वहाँ हमेशा प्राप्त करने का एक तरीका है जिसे आप या तो एक (XOR) के साथ चाहते हैं;

ListView सबसे आम दृश्य है (यदि सभी में नहीं) तो Android एप्लिकेशन काफी लचीले हैं और कुछ बहुत प्रभावशाली चीजें कर सकते हैं।