I have this code:
(binding.photos.layoutManager as GridLayoutManager).spanSizeLookup =
object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return when (messages.size) {
// how to use this
}
}
}
xml for my image:
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearance="@style/ShapeAppearanceOverlay.ChatPhoto"
tools:ignore="ContentDescription" />
I'm making a chat app where the user can send photos. There may be 3 cases:
When there is only one photo, the picture takes up the entire width and height
When there are two pictures, then everything is divided into two parts (right and left)
When there are three pictures, the first photo remains on the left as in the second case, and the remaining two are divided by the right container, which in turn is divided into two equal parts:
How can i make it?
