I try to scroll my recycler view to the last element.
When I remove app:layout_behavior="@string/appbar_scrolling_view_behavior" from refresh layout t
en it works fine.
I am not sure why adding app:layout_behavior="@string/appbar_scrolling_view_behavior" causes this issue but it seems like it makes the swipRefresh layout goes beyond the bottom border
Note: I use recyclerView.smoothScrollToPosition to reach to last element
Could anyone tell me how can I fix this issue?
Here is the code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Toolbar -->
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="@+id/left_menu"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/space8dp"
android:tint="?attr/hamburgerIconTintColor"
app:srcCompat="@drawable/ic_back" />
<TextView
android:id="@+id/title"
style="@style/SubHeader"
android:layout_width="match_parent"
android:layout_height="@dimen/space32dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_toStartOf="@+id/btn_room_members"
android:layout_toEndOf="@+id/left_menu"
android:background="?attr/selectableItemBackground"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
tools:text="From Jamie Thompson" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_room_members"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/space8dp"
android:tint="?attr/hamburgerIconTintColor"
app:srcCompat="@drawable/ic_members" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom"
android:layout_below="@+id/toolbar">
<!-- MainView -->
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/space16dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<!-- Selfies -->
<com.selfieyo2.core.utils.customview.ImageSetView
android:id="@+id/imv_set"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
tools:background="@color/colorPrimary" />
<ImageView
android:id="@+id/imv_video_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:clickable="false"
android:focusable="false"
android:scaleType="fitCenter"
android:visibility="gone"
app:srcCompat="@drawable/ic_videocam"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/tv_uploading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<com.wang.avi.AVLoadingIndicatorView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:indicatorName="BallScaleMultipleIndicator" />
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/space8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="@dimen/space4dp"
tools:itemCount="1"
tools:listitem="@layout/listitem_other_chat" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<RelativeLayout
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingStart="@dimen/space8dp"
android:paddingEnd="@dimen/space8dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_send_media_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/space8dp"
android:tint="?attr/hamburgerIconTintColor"
android:visibleGone="@{isPrivateOrHotRoom}"
app:srcCompat="@drawable/ic_chat_attach_file"
tools:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_hashtags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/btn_send_media_file"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/space8dp"
android:tint="?attr/hamburgerIconTintColor"
app:srcCompat="@drawable/ic_hashtag" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/edt_chat_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginTop="@dimen/space8dp"
android:layout_marginBottom="@dimen/space8dp"
android:layout_toStartOf="@id/btn_send"
android:layout_toEndOf="@id/btn_hashtags"
android:background="@drawable/edt_chat_bg"
android:ellipsize="end"
android:fontFamily="@font/regular"
android:hint="@string/chat_newmessage_placeholder"
android:imeOptions="actionSend"
android:inputType="textMultiLine"
android:maxLength="160"
android:maxLines="6"
android:minHeight="42dp"
android:textColor="?attr/chatInputTextColor"
android:textColorHint="?attr/chatInputTextColor"
android:textSize="15sp"
tools:hint="How are you today ? This is too long text to check the end?" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_send"
android:layout_width="wrap_c
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…