0
我想一个drawableleft添加到EDITTEXT:如何将drawableleft边框与其父edittext的边框相匹配?
<EditText
android:id="@+id/editUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/icon_email"
android:hint="@string/login_identity_hint"
android:textSize="12sp" />
这里是如何看起来像:
正如你看到的,图像不匹配其父母的边界,有即使我没有设置任何填充,也是从左边,底部和顶部填充。我能做些什么呢?
我也尝试以下方法:
<RelativeLayout
android:id="@+id/editUserNameContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon_email"
android:layout_alignParentLeft="true"/>
<EditText
android:layout_toRightOf="@+id/img"
android:id="@+id/editUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:hint="hint"
android:textSize="12sp" />
</RelativeLayout>
但是这一次,它看起来像如下:影像和EditText上的高度不匹配,并且他们之间有一个小的差距:
谢谢。