मुझे टेक्स्टव्यू के शीर्ष पर क्रॉस बटन डालने में समस्या का सामना करना पड़ रहा है। मैं लीनियरलाउट का उपयोग कर रहा हूं और यह उस पर नहीं आ रहा है, जबकि Framelayout पर यह काम करता है लेकिन यह मेरे उद्देश्य को हल नहीं करता है। मैं संदर्भ के लिए अपने एक्सएमएल संलग्न कर रहा हूं, कृपया इस समस्या पर काबू पाने में मेरी मदद करें।एंड्रॉइड: स्वत: पूर्ण पाठ के शीर्ष पर क्रॉस आइकन कैसे डालें
<LinearLayout
android:id="@+id/top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/phone_toolbar"
android:baselineAligned="true"
android:gravity="center_horizontal"
android:paddingBottom="2dp"
android:paddingTop="2dp" >
<ImageView
android:id="@+id/search_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:background="@drawable/toolbar_search_icon_phone" >
</ImageView>
<AutoCompleteTextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2"
android:background="@drawable/toolbar_phone_textfield"
android:dropDownVerticalOffset="5dp"
android:ems="10"
android:focusable="true"
android:hint="@string/hint"
android:imeOptions="actionSearch"
android:paddingLeft="10dp"
android:paddingRight="20dp"
android:singleLine="true"
android:textColor="#000000"
android:textSize="14sp" />
<Button
android:id="@+id/clear_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="10dip"
android:background="@drawable/text_clear" />
</LinearLayout>
धन्यवाद!
इसके लिए धन्यवाद, लेकिन मैं उस ड्रॉइंग पर इवेंट क्लिक को कैसे ट्रैक कर सकता हूं। मैं स्वत: पूर्ण टेक्स्टव्यू में मौजूद पाठ को साफ़ करना चाहता हूं। – Anupam
ठीक अपडेट किए गए प्रश्न की जांच करें और लिंक –
पर भी आपके कोड के साथ कोई समस्या है। यह et.setCompoundDrawables के बजाय कॉम्पैन्डड्राउबल WithIntrinsicBounds सेट किया जाना चाहिए –