本文介紹了如何在 EditText 中放置按鈕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想在 EditText 中放置一個圖像按鈕,但我沒有 Idea 請告訴我如何操作,如圖所示.謝謝
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
推薦答案
如果你不想點擊那個圖片,那么你可以使用 EditText 的 drawableRight
屬性..
If You dont want click on that Image, Then you can use drawableRight
property for EditText..
android:drawableRight="@drawable/icon"
如果你想點擊然后使用下面的代碼.
If you want click then use below code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter search key" />
<ImageButton
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/search"
android:layout_centerVertical="true"
android:layout_margin="5dp"
android:text="Button"/>
</RelativeLayout>
這篇關于如何在 EditText 中放置按鈕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!