0

I am using SwipeRevealLayout for swipe-to-delete in recyclerview item.I have textview (height is not stable may vary) and swipe layout. When I have text more than 3 rows , swipelayout height doesnt change. It comes short.What can I do to make it have the same height as the text length ?


 - <com.chauthai.swipereveallayout.SwipeRevealLayout
           android:id="@+id/swipeLayout"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           app:dragEdge="right"
           app:mode="same_level">
       <!-- swipe delete layout -->  
         <LinearLayout
               android:id="@+id/delete_layout"
               android:layout_width="64dp"
               android:layout_height="match_parent"
               android:gravity="center"
               android:orientation="vertical">
       <LinearLayout
                   android:layout_width="64dp"
                   android:layout_height="match_parent"
                   android:gravity="center"
                   android:orientation="vertical">
       <androidx.appcompat.widget.AppCompatImageButton
                       android:layout_width="wrap_content"
                       android:layout_height="match_parent"
                       android:clickable="false"
                       android:padding="5dp"
                     />
       <TextView
                       style="@style/TextStyle.Bold"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:text="@string/delete"
                       android:textColor="@color/colorWhite" />
       </LinearLayout>
       </LinearLayout>
       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:orientation="vertical">
       <LinearLayout
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:gravity="center"
               android:orientation="horizontal">
       </LinearLayout>
       <androidx.constraintlayout.widget.ConstraintLayout
                   android:layout_width="match_parent"
                   android:layout_height="match_parent">
        <LinearLayout
                           android:layout_width="0dp"
                           android:layout_height="wrap_content"
                           android:layout_marginEnd="4dp"
                           android:layout_marginRight="4dp"
                           android:gravity="center_vertical"
                           android:minHeight="52dp"
                           android:orientation="vertical"
                           android:showDividers="middle"
                           app:layout_constraintStart_toStartOf="parent"
                           app:layout_constraintTop_toTopOf="parent">
       <LinearLayout
                               android:layout_width="match_parent"
                               android:layout_height="wrap_content">
       <ImageView
                                   android:layout_width="30dp"
                                   android:layout_height="30dp"
                                  >
       </ImageView><TextView
                                   android:id="@+id/title"
                                   style="@style/TextStyle"
                                   android:layout_height="wrap_content"
                                   android:paddingLeft="10dp"
                                   android:paddingTop="2dp"
                                   android:paddingEnd="8dp"
                                   android:layout_gravity="center"
                                   android:paddingBottom="2dp"
                                  </LinearLayout>
       <TextView
                               android:id="@+id/itemText"
                               android:paddingTop="5dp"
                               android:layout_marginRight="10dp"
                               android:layout_width="match_parent"
                               android:layout_height="match_parent"
                               android:text="Test"/></LinearLayout>
       <LinearLayout
                           android:id="@+id/iconArea"
                           android:layout_width="wrap_content"
                           android:layout_height="wrap_content"
                           android:gravity="center_vertical"
                           android:orientation="horizontal"
                           app:layout_constraintBottom_toBottomOf="@+id/modelArea"
                           app:layout_constraintEnd_toEndOf="parent"
                           app:layout_constraintTop_toTopOf="@+id/modelArea">
       <ImageView
                               android:layout_width="wrap_content"
                               android:layout_height="wrap_content"
                               android:layout_marginLeft="10dp"
                              /></LinearLayout>
       </androidx.constraintlayout.widget.ConstraintLayout>
       </LinearLayout>
       </LinearLayout>
       </com.chauthai.swipereveallayout.SwipeRevealLayout>

Do you have any idea ?

k.kbr
  • 45
  • 6
  • You have been using 3rd party library which I am not familiar with. It might be a bug a library, bug in your implementation or something else. From my perspective the right way is to localise the issue by running this code on emulators with different Android API, double check sample code from library github, dive deeper in source code to understand where the issue and fix it or open issue in the library repository. – Gleichmut Jan 30 '23 at 08:30

0 Answers0