के अंदर चेक किए गए टेक्स्ट दृश्य को चेक/अनचेक करने में असमर्थ मैं कस्टम सूची दृश्य में फ़ोन संपर्क लोड कर रहा हूं। प्रत्येक पंक्ति एक चेक करने योग्य LinearLayout है जिसमें एक चेकडटेक्स्ट व्यू और एक अन्य टेक्स्ट व्यू होता है।GetView
मैं एक कस्टम ArrayAdapter के साथ सूची दृश्य खिला रहा हूँ। मेरी समस्या यह है कि मैं getView() के अंदर CheckedTextViews को नियंत्रित नहीं कर सकता। उदाहरण के लिए जब मैं निम्नलिखित
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if(row == null){
row = inflater.inflate(layout, parent, false);
}
CheckedTextView checkedTextView = (CheckedTextView) row.findViewById(R.id.checkedTextView);
checkedTextView.setText("A");
checkedTextView.setChecked(true);
return row;
}
हर पाठ दृश्य जब भी मैं सूची दृश्य स्क्रॉल जाँच करने के लिए चाहिए था कि कोशिश, लेकिन वह नहीं हो रहा है। क्या कोई मुझे बता सकता है कि यह कैसे करें?
संपादित करें: यह getView() के अंदर यह जांच करने के लिए महत्वपूर्ण है, मैं सिर्फ सभी setListAdapter()
EDIT2 के बाद जांच नहीं कर सकता: यह एक्सएमएल प्रत्येक पंक्ति को देखते दिखा फ़ाइल है
<?xml version="1.0" encoding="utf-8"?>
<com.example.multiplecontacts.CheckableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<CheckedTextView
android:id="@+id/checkedTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:paddingBottom="0dp"
android:text="CheckedTextView"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/subTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Small Text"
android:paddingTop="0dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</com.example.multiplecontacts.CheckableLinearLayout>
चेक करने योग्य लाइनेरआउट एक कस्टम लेआउट है जो लाइनरलाइट और लागू करता है जैसा कि मैंने पहले कहा था चेकआउट योग्य है। और मैंने इसे here
मैं इसकी आवश्यकता नहीं है डिफ़ॉल्ट रूप से चेक किया जाना है। असल में उपर्युक्त कोड मेरा वास्तविक कोड नहीं है, यह सिर्फ मेरी समस्या का प्रदर्शन करने वाला एक नमूना है। मुझे जो कुछ चाहिए वह है GetView() –
के अंदर एक चेकड टेक्स्टव्यू टॉगल करने में सक्षम होना है, कृपया आप xml –
पोस्ट कर सकते हैं आपको 'चेकबॉक्स' के साथ लेआउट मिला है, लेकिन जब आप 'चेकबॉक्स' दबाते हैं तो चेक नहीं किया जाता है? –