Android 如何在textview中保存文本位置

Android 如何在textview中保存文本位置,android,textview,Android,Textview,我想做的是在我的文本视图中阅读段落时,以及出于任何原因 我退出应用程序或点击Back按钮如何让我的段落保存我正在阅读的地方 我希望你能理解我,我试过这个,但它不起作用 <TextView android:id="@+id/id_dailyprayers_txt" android:layout_width="match_parent" android:layout_height="wrap_content" android:ba

我想做的是在我的文本视图中阅读段落时,以及出于任何原因

我退出应用程序或点击Back按钮如何让我的段落保存我正在阅读的地方

我希望你能理解我,我试过这个,但它不起作用

<TextView
        android:id="@+id/id_dailyprayers_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#00000000"
        android:ems="10"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:gravity="center"
        android:shadowColor="@color/black"
        android:shadowDx="2"
        android:shadowDy="2"
        android:shadowRadius="1.5"
        android:text=""
        android:freezesText="true"
        android:textColor="@color/Vanilla"
        android:textSize="35sp" />

有什么帮助吗?

您是否尝试过按handle back按钮并保存文本滚动条并将其保存在SharedReference中,然后在应用程序重新打开时加载它

@Override
public void onBackPressed() {  
getApplicationContext().getSharedPreferences("myData", 0).edit().putInt("lastPos", tv.getScrollY());
super.onBackPressed();
}
把这个放在一个容器里

//first remember to defined tv
tv.scrollTo(0,getApplicationContext().getSharedPreferences("myData", 0).getInt("lastPos", 0)); 
关于

请参阅,了解如何保存文本视图的滚动位置。