【发布时间】:2020-11-17 18:12:31
【问题描述】:
我正在尝试构建如下图所示的 UI:
请同时检查:https://imgur.com/a/fXPRBez
我的代码:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:background="@drawable/drawableborder"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_attachment"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:paddingStart="@dimen/padding_big"
android:paddingEnd="@dimen/padding_big"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/frameLayout"
app:srcCompat="@drawable/ic_gallery" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gv_attach_image"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_toStartOf="@+id/iv_attachment"
android:layout_toLeftOf="@+id/iv_attachment"
android:nestedScrollingEnabled="true"
android:numColumns="3"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tell_us_more" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tell_us_more"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/what_do_you_need_help"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tell_us_moreone"
style="@style/whathelpdoyouneedontextinput"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dell_grey2"
app:layout_constraintTop_toBottomOf="@+id/gv_attach_image">
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
这会生成如下所示的 UI:
如您所见,这会在TextInputLayout 和边框之间产生一个小间隙。我该如何解决这个问题?
【问题讨论】:
-
问题为什么降级了?
-
我也有这个问题。点赞。
-
谢谢,为 android 创建类似的 UI 有什么运气吗?
-
style/whathelpdoyouneedontextinput呢?
标签: android xml android-layout user-interface