Я использую ConstraintLayout, чтобы получить эту структуру. Но на последнем изображении значок плюса наполовину скрыт. И во всех трех изображениях, если я устанавливаю изображения, часть символа плюса или креста скрывается. Я пробовал установить высота или tranlationZ, но у меня это не сработало.
Пожалуйста, помогите мне с этим вопросом.
Это мой фрагмент кода.
<!-- Constraint Layout -->
<android.support.constraint.ConstraintLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal"
android:paddingEnd = "@dimen/_16dp"
android:paddingStart = "@dimen/_16dp"
android:paddingTop = "@dimen/_16dp"
tools:ignore = "ContentDescription">
<!-- Profile Pic -->
<ImageView
android:id = "@+id/img_profilePic"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintStart_toStartOf = "parent" />
<ImageView
android:id = "@+id/img_profilePic_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
app:layout_constraintBottom_toBottomOf = "@+id/img_profilePic"
app:layout_constraintEnd_toEndOf = "@+id/img_profilePic"
app:layout_constraintStart_toEndOf = "@+id/img_profilePic"
app:layout_constraintTop_toBottomOf = "@+id/img_profilePic" />
<!-- Gallery Pic 1 -->
<ImageView
android:id = "@+id/img_galleryPic1"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintEnd_toStartOf = "@+id/img_galleryPic2"
app:layout_constraintStart_toEndOf = "@+id/img_profilePic" />
<ImageView
android:id = "@+id/img_galleryPic1_add"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_add_circle"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic1" />
<ImageView
android:id = "@+id/img_galleryPic1_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
android:visibility = "gone"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic1" />
<!-- Gallery Pic 2 -->
<ImageView
android:id = "@+id/img_galleryPic2"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintEnd_toEndOf = "parent" />
<ImageView
android:id = "@+id/img_galleryPic2_add"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_add_circle"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic2"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintHorizontal_bias = "1.0"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic2" />
<ImageView
android:id = "@+id/img_galleryPic2_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
android:visibility = "gone"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic2"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic2" />
</android.support.constraint.ConstraintLayout>
поставить горизонтальную прокрутку
<HorizontalScrollView
android:layout_width = "match_parent"
android:layout_height = "match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal"
android:paddingEnd = "16dp"
android:paddingStart = "16dp"
android:paddingTop = "16dp"
tools:ignore = "ContentDescription">
<!-- Profile Pic -->
<ImageView
android:id = "@+id/img_profilePic"
android:layout_width = "80dp"
android:layout_height = "80dp"
android:background = "@color/black"
app:layout_constraintStart_toStartOf = "parent" />
<ImageView
android:id = "@+id/img_profilePic_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/call_cam_toggle_background"
app:layout_constraintBottom_toBottomOf = "@+id/img_profilePic"
app:layout_constraintEnd_toEndOf = "@+id/img_profilePic"
app:layout_constraintStart_toEndOf = "@+id/img_profilePic"
app:layout_constraintTop_toBottomOf = "@+id/img_profilePic" />
<!-- Gallery Pic 1 -->
<ImageView
android:id = "@+id/img_galleryPic1"
android:layout_width = "80dp"
android:layout_height = "80dp"
android:background = "@color/black"
app:layout_constraintEnd_toStartOf = "@+id/img_galleryPic2"
app:layout_constraintStart_toEndOf = "@+id/img_profilePic" />
<ImageView
android:id = "@+id/img_galleryPic1_add"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/call_cam_toggle_background"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic1" />
<ImageView
android:id = "@+id/img_galleryPic1_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
android:visibility = "gone"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic1" />
<!-- Gallery Pic 2 -->
<ImageView
android:id = "@+id/img_galleryPic2"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintEnd_toEndOf = "parent" />
<ImageView
android:id = "@+id/img_galleryPic2_add"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_add_circle"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic2"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintHorizontal_bias = "1.0"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic2" />
<ImageView
android:id = "@+id/img_galleryPic2_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
android:visibility = "gone"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic2"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic2" />
</android.support.constraint.ConstraintLayout>
</HorizontalScrollView>
Попробуйте это => вы должны указать правильное ограничение для этого
Задайте ограничение конца изображения 0-й галереи начальному ограничению изображения 1-й галереи и ограничение начала изображения 2-й галереи ограничению конца изображения 1-й галереи
вы также можете сделать это с помощью цепочки
<android.support.constraint.ConstraintLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal"
android:paddingEnd = "@dimen/_16dp"
android:paddingStart = "@dimen/_16dp"
android:paddingTop = "@dimen/_16dp"
tools:ignore = "ContentDescription">
<!-- Profile Pic -->
<ImageView
android:id = "@+id/img_profilePic"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintEnd_toStartOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toStartOf = "parent" />
<ImageView
android:id = "@+id/img_profilePic_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
app:layout_constraintBottom_toBottomOf = "@+id/img_profilePic"
app:layout_constraintEnd_toEndOf = "@+id/img_profilePic"
app:layout_constraintStart_toEndOf = "@+id/img_profilePic"
app:layout_constraintTop_toBottomOf = "@+id/img_profilePic" />
<!-- Gallery Pic 1 -->
<ImageView
android:id = "@+id/img_galleryPic1"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintEnd_toStartOf = "@+id/img_galleryPic2"
app:layout_constraintStart_toEndOf = "@+id/img_profilePic" />
<ImageView
android:id = "@+id/img_galleryPic1_add"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_add_circle"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic1" />
<ImageView
android:id = "@+id/img_galleryPic1_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
android:visibility = "gone"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic1" />
<!-- Gallery Pic 2 -->
<ImageView
android:id = "@+id/img_galleryPic2"
android:layout_width = "@dimen/_80dp"
android:layout_height = "@dimen/_80dp"
android:background = "@color/bg_light_gray"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic1"
app:layout_constraintEnd_toEndOf = "parent" />
<ImageView
android:id = "@+id/img_galleryPic2_add"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_add_circle"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic2"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintHorizontal_bias = "1.0"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic2" />
<ImageView
android:id = "@+id/img_galleryPic2_delete"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@drawable/icon_cross"
android:visibility = "gone"
app:layout_constraintBottom_toBottomOf = "@+id/img_galleryPic2"
app:layout_constraintEnd_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintStart_toEndOf = "@+id/img_galleryPic2"
app:layout_constraintTop_toBottomOf = "@+id/img_galleryPic2" />
</android.support.constraint.ConstraintLayout>
просто изменить положение изображения означает первое место + изображение в xml
Это не сработало. Просто спрашиваю, как вы думаете, может ли быть проблема с файлом в формате png?
Эта проблема решила проблему наполовину скрытого изображения. Но у меня все еще проблема с возвышением. Например, когда серый прямоугольник на изображении (изображение в вопросе) заменяется реальным изображением, часть изображения X или + оказывается под ним, т.е. скрывается.