簡體   English   中英

RecyclerView中的項目位置未保存

[英]The item position in the RecyclerView is not saved

我使用模式AdjustResize,RecyclerView和EditText,當鍵盤出現時,窗口縮小,但RecyclerView中的可見元素下降。

布局的結構如下所示:

<LinearLayout
    android:orientation="vertical">

    <android.support.v7.widget.RecyclerView />

    <LinearLayout
        android:orientation="vertical"
        android:layout_gravity="bottom"/>

</LinearLayout>

我在LinearManager中將setStackFromEnd設置為true,但這沒有幫助。

庫的版本:25.3.0

如何避免這個不愉快的問題?

而不是在頂部使用線性布局,而是使用相對布局,如下所示...

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
    <LinearLayout
        android:id="@+id/bottom_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical"/>

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/bottom_view"/>
</RelativeLayout> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM