मैं कस्टम एडाप्टर के साथ एक ListView उपयोग कर रहा हूँ को निष्क्रिय यह बस है एक TextViewएंड्रॉयड ListView जब आइटम फ़ोकस करने योग्य हैं, क्लिक
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_item_content"
android:background="@drawable/list_item1"
android:layout_width="fill_parent" android:layout_height=""wrap_content"
/>
यहाँ मेरा चयनकर्ता पृष्ठभूमि:
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_enabled="false"
android:state_pressed="true"
android:drawable="@drawable/draw_list_item1" />
<item android:state_focused="true" android:state_enabled="false"
android:drawable="@drawable/draw_list_item_focused" />
<item android:state_focused="true" android:state_pressed="true"
android:drawable="@drawable/draw_list_item_selected" />
<item android:state_focused="false" android:state_pressed="true"
android:drawable="@drawable/draw_list_item_selected" />
<item android:state_focused="true"
android:drawable="@drawable/draw_list_item_focused" />
<item android:drawable="@drawable/draw_list_item1"/>
</selector>
समस्या है जब मैं कर रहा हूँ TextView
गुण: android:clickable="true"
और android:focusable="true"
तब मैं अपना केंद्रित बनाम देखता हूं पृष्ठभूमि पर, लेकिन इन कारणों को सूची आइटमों को क्लिक करने के लिए क्लिक और लंबे क्लिक का जवाब नहीं दिया जाता है। जब इन 2 गुणों को हटा दिया जाता है तो सभी ListItems क्लिक और लंबे क्लिक का जवाब देते हैं।
क्या किया जाना चाहिए जो फोकस करने योग्य पृष्ठभूमि को दृश्यमान बनाएगा और काम पर दोनों प्रतिक्रियाओं पर क्लिक करेगा।
मैंने getListView().setItemsCanFocus(true)
पर कॉल करने का प्रयास किया है लेकिन समस्याएं अभी भी बनी रहती हैं।
काम नहीं कर रहा है। सभी आइटम अब केंद्रित स्थिति में हैं। ListView मेरे लेआउट में एकमात्र दृश्य है i.e. चौड़ाई और ऊंचाई fill_parent – Shardul
@Shardul पर सेट है: आपका मतलब है कि आपके पास एक साथ कई सूची आइटम चुने गए हैं? –
जब कोईता शुरू नहीं होती है तो सभी वस्तुओं में पृष्ठभूमि होती है जो मेरे चयनकर्ता में निर्दिष्ट केंद्रित पृष्ठभूमि जैसा दिखता है। और फिर भी न तो आइटम क्लिक पर प्रतिक्रिया दे रहा है। – Shardul