Inserting imageview inside edittext android

前端 未结 3 1685
南旧
南旧 2021-01-17 08:49

I want to place imageview inside edittext. Would it be possible? I checked \"evernote\" application, and it was able to put photo on the edittext part. I want to make my app

3条回答
  •  既然无缘
    2021-01-17 09:26

    Use this:

    
    

    you can use drawable left,right,top or bottom of your text according to your need.

    To manipulate in java use this:

    EditText editText = (EditText) findViewById(R.id.yourEditTextId);
    editText.setCompoundDrawablesWithIntrinsicBounds(left,top,right,bottom);
    

    for manipulating image set on right:

    editText.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.yournewimage,0);
    

    similarly you can do it for other cases.

    Hope it helps!!!

提交回复
热议问题