当前位置: 动力学知识库 > 问答 > 编程问答 >

android - EditText changes color as the screen rotates

问题描述:

I have an EditText that takes the color of an xml.

myr1.setTextAppearance(getApplicationContext(), R.style.myr_ok);

I know that when you rotate the screen activity is destroyed, and I managed to retrieve some data (values, status button) using onSaveInstanceState () but I can not find how to retrieve the color of the edit text (can be green or red) and keep .

Is it possible with onSaveInstanceState () or I have to use another way?

网友答案:

You can use getTextColors() in onSaveInstanceState to retrieve the current color state list for the TextView. Alternatively you could keep a variable remembering the resource ID of which text appearance style you last set, and save this in onSaveInstanceState

分享给朋友:
您可能感兴趣的文章:
随机阅读: