Android 在约束布局中创建自定义布局
如何根据图中显示的布局在约束布局中进行自定义布局Android 在约束布局中创建自定义布局,android,android-constraintlayout,Android,Android Constraintlayout,如何根据图中显示的布局在约束布局中进行自定义布局 左父级+右父级图标 编辑文本位于左至右图标+右父级 按钮位于编辑文本内,具有右重力 EditText中的自定义背景 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_h
左父级+右父级图标 编辑文本位于左至右图标+右父级 按钮位于编辑文本内,具有右重力
EditText中的自定义背景
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/iconImage"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:src="@mipmap/ic_launcher_round"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintLeft_toRightOf="@id/iconImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toLeftOf="@id/imageBtn"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:hint="I want to..." />
<ImageButton
android:id="@+id/imageBtn"
android:layout_width="48dp"
android:layout_height="48dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
我们使用了约束布局,这样就没有层次结构了,我们可以在其中使用线性布局吗???@Harleendut我已经编辑了答案,只使用了ConstraintLayout
thanku,但是您的答案是不正确的,因为如果我将edittext端点放在右imageview的开头,那么我将如何在edittext中显示该图标