【发布时间】:2018-09-04 09:25:03
【问题描述】:
我正在使用带有 drawableLeft 属性的 EditText 并在左侧设置 ImageView 以显示移动图标。我的问题是如何将 Imageview 放入 EditText?
请帮帮我。
其实我也想要这样。
我尝试过使用水平的线性布局。下面是xml代码。
<LinearLayout
android:weightSum="2"
android:layout_below="@id/welcome"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_weight="1"
android:layout_gravity="center"
android:id="@+id/image_mobile"
android:layout_width="@dimen/_50sdp"
android:layout_height="@dimen/_50sdp"
android:src="@mipmap/ic_launcher" />
<EditText
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_30sdp"
android:layout_toRightOf="@+id/image_mobile"
android:hint="Mobile number"
android:inputType="text" />
</LinearLayout>
但我无法调整图像视图和编辑文本。
【问题讨论】:
-
如果你只是想用它显示任何图像,你可以使用left_drawable和edittext
-
获得所需外观的简单方法是为您的线性布局设置一个可绘制对象,它会给出您想要的印象。