Could I keep position of ScrollView after back to prev Fragment like ListView?

前端 未结 1 815
北恋
北恋 2020-12-10 00:44

I have tried to use both ScrollView and ListView.

I figured out that if I use ListView and I click one of items let current fragment be replaced by next fragment and

相关标签:
1条回答
  • 2020-12-10 01:41

    Fragments automatically save and restore the states of their Views, as long they have IDs assigned.

    So if you assign an ID to your ScrollView, its scroll state can be restored:

    <ScrollView android:id="@+id/scrollview"
        ...>
    
    0 讨论(0)
提交回复
热议问题