First picture describe what I want, and second picture is what I got.
Black rectangle means RecyclerView, dark red means it's item. Navy is ImageView.
I tried clipChildren on parent viewgroup where recyclerview belong to.
Is there any wany to achieve that ? (I also tried animation)
val animation = TranslateAnimation(
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, -dpToPixel(21f, itemView.context)
)
animation.duration = 0
imageView.startAnimation(animation)
--- EDIT ---
Activity Layout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@android:color/black"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
ViewHolder Layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="50dp"
android:layout_height="50dp">
<!-- image -->
<View android:id="@+id/dummy"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/holo_green_dark"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<!-- marker here -->
<View android:layout_width="20dp"
android:layout_height="20dp"
android:translationX="-5dp"
android:translationY="-5dp"
android:background="@android:color/holo_red_dark"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Note that I can't give more height than 60dp and inner item has fixed height (50dp).



