क्या सूची दृश्य में चयनित आइटम को साफ़ करने का कोई तरीका है?साफ़ सिंगलचॉइस सूची दृश्य चयन
ListView इस तरह परिभाषित किया गया है:
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="50dp"
android:id="@+id/example_list"
android:layout_weight="2"
android:choiceMode="singleChoice"/>
और एक कस्टम एडाप्टर का उपयोग भर जाता है।
चयनित आइटम एक चयनकर्ता का उपयोग कर हाइलाइट किया गया है:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<gradient
android:startColor="#3E5260"
android:endColor="#3E5260"
android:angle="270" />
</shape>
</item>
<item android:state_activated="true">
<shape>
<gradient
android:startColor="#3E5260"
android:endColor="#3E5260"
android:angle="270" />
</shape>
</item>
</selector>
अब क्या मैं वास्तव में है एक ही गतिविधि में 2 listviews है और मैं में आइटम का चयन रद्द करना चाहते हैं एक आइटम
एक ListView में चयनित है जब अन्य ListView।
void DeviceList_Click(object sender, EventArgs e)
{
//easy enough to check which ListView raised the event
//but then I need to deselect the selected item in the other listview
}
मैं जैसी चीजों की कोशिश की है:
दोनों listviews निम्नलिखित हैंडलर जब एक आइटम क्लिक किया जाता है बढ़ा
exampleList.SetItemChecked(exampleList.SelectedItemPosition, false);
और
exampleList.SetSelection(-1);
लेकिन वह दिखाई नहीं देता काम करने के लिए।
यह काम करता प्रतीत होता है, उसने कोशिश नहीं की थी, धन्यवाद – TimothyP
=> नोटेशन क्या है? मैंने एंड्रॉइड कोड में कभी नहीं देखा है। –
@ इगोरगानापोलस्की यह एक लैम्ब्डा अभिव्यक्ति है, एक अज्ञात विधि है। यह सी # है। जावा में आपके पास 'IOnClickListener' कार्यान्वयन हैं। – Cheesebaron