提示的EditText文本和图标 [英] EditText Hint Text and Icon

查看:162
本文介绍了提示的EditText文本和图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个提示,图标和文本两者一起一个EditText。但提示文本去市中心,但我想提示文本被lefet对齐,这样应该只有提示图标,提示文本之间的片(间隙)。

I am trying to create an EditText with the hint as icon and text both together. But hint text goes to the center but I want hint text to be lefet aligned so that there should only be a tab space (gap) between hint icon and hint text.

这是我曾尝试:

<EditText
        android:id="@+id/emailAddressInput"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:ems="10"
        android:layout_marginTop ="20dp"
        android:layout_marginLeft ="20dp"
        android:layout_marginRight ="20dp"
        android:background="@drawable/rounded_edge"
        android:drawableLeft="@drawable/email_box"
        android:hint="e-mail address"
        android:gravity="left|center_vertical"
        android:maxLength="100"
        android:inputType="textEmailAddress" />

任何想法如何,我可以达到预期的效果?

Any idea how can I achieve desired result?

推荐答案

好了那么一点点调试完毕后,我发现图像的大小正在采取这么多的空间,我有图像裁剪到更小的尺寸和它的工作。

Okay so after a little debugging, I found out that the image size was taking that much space, I have cropped the image to smaller size and it worked.

这篇关于提示的EditText文本和图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆