I want to place an image button inside of EditText, but I don't have Idea please tell me how to do so as shown in the figure . Thanks
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
There's solution with clickable compound drawable. It's working very well - I have tested it
SOLUTION
Place your EditText inside a linear layout (horizontal) and add a Image Button next to it (0 padding). Setting the background color of EditText and ImageButton will blend in.
you can Use the Below Code :
android:drawableRight="@android:drawable/ic_menu_search"
If You dont want click on that Image, Then you can use
drawableRight
property for EditText..If you want click then use below code.
Use the android:drawableLeft property on the EditText.
My solution will fit all screen sizes without the
editText
going "behind" theimageButton
. This also uses android resources, so you do not need to provide your own icon or string resource. Copy and paste this snippet wherever you would like a search bar:Restult: