屏幕旋转后恢复的TextView的状态呢? [英] Restoring state of TextView after screen rotation?

查看:430
本文介绍了屏幕旋转后恢复的TextView的状态呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序我有的TextView EditView中。两人都在它的数据。当屏幕方向改变了数据的 EditView中仍然存在,但的TextView 数据被清除。

In my app I have Textview and EditView. Both have data in it. When the screen orientation changes the data in the Editview remains, but Textview data is cleared.

我很困惑......

I am confused ...

可以有一个人帮助我找到一种方法来保留数据的TextView 吗?

Can some one help me out to find a way to retain data in TextView too?

推荐答案

如果要强制你的的TextView 保存其状态必须添加<一href="http://developer.android.com/reference/android/widget/TextView.html#attr_android%3afreezesText"><$c$c>freezesText属性:

If you want to force your TextView to save its state you must add freezesText attribute:

<TextView 
     ... 
     android:freezesText="true" />

从技术文档的<一个href="http://developer.android.com/reference/android/widget/TextView.html#attr_android%3afreezesText"><$c$c>freezesText

如果设置,文本视图将包括其冻结的冰柱除了元数据的内部当前的完整文本,如当前的光标位置。默认情况下,这是禁用的;当一个文本视图的内容未存储在持久性的地方也可以是有用的诸如内容提供商

If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider

这篇关于屏幕旋转后恢复的TextView的状态呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆