android - 为什么 drawableLeft 出现在 EditText 之外?

标签 android android-edittext

Image

为什么图标出现在 EditText/divider 之前?

这是我的代码:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fragment_sign_in"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
tools:context="com.*.*.*.SignInFragment">

   <!-- This is the EditText -->
  <com.rey.material.widget.EditText 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:drawableStart="@drawable/email"
    android:drawableLeft="@drawable/email"
    android:padding="0dp"
    android:hint="test"
    app:et_dividerHeight="1dp" />

</android.support.constraint.ConstraintLayout>

最佳答案

你可以使用

 android:drawablePadding="5dp" // Add your own values

可绘制对象和文本之间的填充。

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

你可以试试

 android:drawableLeft="2dp" 
 android:paddingLeft="3dp"

The drawable to be drawn to the left of the text.

关于android - 为什么 drawableLeft 出现在 EditText 之外?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39121588/

相关文章:

android - 在 Android 中使用 Google SignIn API 获取用户的名字和姓氏

android - UnsatisfiedLinkError : dalvik. system.PathClassLoader

android - 如何更改程序代码中的EditText 边框线颜色?

android - 在多行edittext android中设置单行对齐

Android:EditText 错误

android - TextView 为 <li> 标签呈现丑陋的项目符号

java - 如何防止 progurad 保留单例类名称

fragment 中未显示 Android EditText 键盘

android - EditText 自定义字符串格式

android - 哪些安卓操作系统版本支持 "Do Not Disturb"设置?