在约束布局中创建自定义布局 Android
Create Custom Layout in Constraint Layout Android
如何根据图中所示的布局在约束布局中制作自定义布局
左父+右父图标
从左到右图标 + 右父级的编辑文本
右重力按钮在 EditText 中
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>
如何根据图中所示的布局在约束布局中制作自定义布局
左父+右父图标
从左到右图标 + 右父级的编辑文本
右重力按钮在 EditText 中
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>