首页 > 解决方案 > 我怎样才能在android中设计这个布局?

问题描述

如何添加这个,一个可点击的图像在edittext中,还有一个带有EditText的按钮,我如何使用android设计这个?

标签: android

解决方案


这应该有效:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorAccent">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/button"
        android:drawableLeft="@drawable/ic_back_navigation" />

    <ImageButton
        android:id="@+id/clickableImageButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/button"
        android:background="@android:color/transparent"
        android:src="@drawable/ic_back_navigation" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:text="ADD" />

</RelativeLayout>

在此处输入图像描述


推荐阅读