आम तौर पर यह focusable
, focusableInTouch
+ clickable
को गलत पर सेट करने के लिए पर्याप्त है। लेकिन यहां यह काम नहीं करता है।इससे बचें कि एडिटटेक्स्ट उपभोग करता है क्लिक करें
मैं EditText
पर होने वाले क्लिक का उपभोग करने के रूप में अच्छी तरह माता-पिता LinearLayout
चाहते हैं, लेकिन यह काम नहीं करता ...
<LinearLayout
android:id="@+id/llText"
android:layout_width="0dp"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/tvText"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="5dp"
android:text="@null" />
<EditText
android:id="@+id/etText"
android:inputType="none"
android:gravity="center_horizontal"
android:focusable="false"
android:focusableInTouchMode="false"
android:clickable="false"
android:layout_width="wrap_content"
android:ems="4"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
</LinearLayout>
मैं editable=false
और inputType=none
कोशिश की, लेकिन यह काम नहीं करता। क्यों नहीं? EditText
क्लिक का उपभोग करता है और इसे अपने माता-पिता को नहीं सौंपता है।
संपादित
मैं एक onClickListener
LinearLayout
को सेट कर रहा हूं और यह काम नहीं करता है, तो मैं सीधे EditText
प्रेस ...
आप की कोशिश की 'एंड्रॉयड है: क्लिक करने योग्य = "सच" 'आपके रैखिक लेआउट पर? –
हां, मैं इसे 'ऑनक्लिक लिस्टनर' पर सेट कर रहा हूं ... यह तब तक काम करता है जब तक मैं 'एडिटटेक्स्ट' नहीं दबाता ... – prom85