There is a markup:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:theme="@style/AppTheme.NoActionBar"> <ImageView android:background="@drawable/food" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/potbacground" /> <LinearLayout android:id="@+id/potehki1" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="@drawable/food" android:orientation="horizontal"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/a1scroll" > <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/eda" android:id="@+id/eda_text" android:textColor="@color/blue" android:textAlignment="center" android:textSize="40sp" android:textStyle="bold" /> </LinearLayout> </ScrollView> </LinearLayout> </FrameLayout> there is a text in the string resources, for example: I flipped through to the middle, went out, I entered the application again and loaded the position where I turned the application. I found an example on the net:
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); final ScrollView scrollView = (ScrollView) findViewById(R.id.a1scroll); final TextView textView = (TextView) scrollView.getChildAt(0); final int firstVisableLineOffset = textView.getLayout().getLineForVertical(scrollView.getScrollY()); final int firstVisableCharacterOffset = textView.getLayout().getLineStart(firstVisableLineOffset); outState.putInt(ScrollViewContainerTextViewFirstVisibleCharacterOffset, firstVisableCharacterOffset); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); final int firstVisableCharacterOffset = savedInstanceState.getInt(ScrollViewContainerTextViewFirstVisibleCharacterOffset); final ScrollView scrollView = (ScrollView) findViewById(R.id.a1scroll); scrollView.post(new Runnable() { public void run() { final TextView textView = (TextView) scrollView.getChildAt(0); final int firstVisableLineOffset = textView.getLayout().getLineForOffset(firstVisableCharacterOffset); final int pixelOffset = textView.getLayout().getLineTop(firstVisableLineOffset); scrollView.scrollTo(0, pixelOffset); } }); } but it is somehow not clear, especially that it is:
ScrollViewContainerTextViewFirstVisibleCharacterOffset