Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove drawable image from edittext through code in android

I have placed an image in edit text by the following code

<EditText
    android:id="@+id/searchfilter"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:hint="Enter search keyword"
    android:drawableRight="@drawable/ic_launcher"/>

I need to hide this image through java code

Thanks in advance

like image 527
varghesekutty Avatar asked Jul 06 '26 21:07

varghesekutty


2 Answers

Try the folloing code

editText.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);

With this you can remove the drawable at the any side of your EditText

editText.setCompoundDrawables(null, null, null, null);
like image 41
kalyan pvs Avatar answered Jul 08 '26 10:07

kalyan pvs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!