【问题标题】:How to set icon right side and bottom of TextInputEditText in android如何在android中设置TextInputEditText的图标右侧和底部
【发布时间】:2020-08-07 12:28:38
【问题描述】:

如何在android中设置TextInputEditText的右侧和底部图标 Show Image

【问题讨论】:

  • 嗨,欢迎来到 SO。请发布一些您尝试过的代码,以便人们可以为您提供一些解决方案。不要期望在这里获得完整的代码。

标签: java android xml image icons


【解决方案1】:

你可以使用这个技巧

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_margin="5dp"
    android:layout_height="200dp">
    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/outlinedTextField"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="@string/label"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

    </com.google.android.material.textfield.TextInputLayout>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/ic_microphone"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:layout_margin="5dp"/>
</RelativeLayout>
  

【讨论】:

    猜你喜欢
    • 2014-04-14
    • 2014-06-02
    • 1970-01-01
    • 2016-02-18
    • 2020-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-02
    相关资源
    最近更新 更多