I have to do an Edit Text with two Font Awesome Icons inside it:
![enter image description here](https://i.stack.imgur.com/zQNDR.png)
我的问题是添加这些图标(左和右),我该怎么做?
这是我的 custom_search.xml 可绘制文件:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<corners
android:bottomRightRadius="5dp"
android:bottomLeftRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<stroke android:color="@color/grayLighter" android:width="1dp"/>
</shape>
您可以使用drawableLeft
and drawabelRight
在你的xml中如下:
<EditText
android:id="@+id/et_drawables_added"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_launcher"
android:drawableLeft="@drawable/ic_launcher"" />
还有更多选择,例如drawableTop
, drawableBottom
。你可以随心所欲地尝试它们。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)