blog-nested-fragments-backstack
blog-nested-fragments-backstack copied to clipboard
It doesn't work when the layout of fragment contain ScrollView
@angelen10 Any additional information? Does the container Fragment contain the ScrollView? Or is it in the nested Fragment? BTW are you trying the View Pager example? or the Nav drawer sample?
It would be great if you could share some snippet or point to a repo containing minimum code that reproduces the issue.
In your project 'nested-fragments-backstack-part3', I just modify a layout file 'fragment_container.xml', look at the code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textColor="#FF0000"
android:text="This is a TextView, Please look" />
<TextView
android:id="@+id/nested_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceLarge" />
<EditText
android:id="@+id/edit_text_nested_frag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin" />
</LinearLayout>
</ScrollView>
OK, when I test your demo, I find that it can save the EditText's state, but can not save the ScrollView's position. Do you understand what I say? Sorry for my poor English.
@angelen10 No worries - this information should be sufficient for me to look into the issue.
I think in the sample, the position of the ScrollView is never saved. I will confirm this later this week.
Thanks.