我可以在触摸视图时保存视图的状态吗?
我想保存触摸时视图的状态。例如,当我触摸一个视图,然后触摸活动中的另一个视图时,我应该能够立即更改两个文本视图的颜色。为此,我需要保存首先触摸的视图的状态。是否可以?
I want to save the state of a view when it is touched. For example when I touch a view and after that I touched the another view in an activity I should be able to change the color of both the textviews at once. For this I need to save the state of the view which is touched at first. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“保存状态”是什么意思?出于您的目的,您只需要保存第一个视图的 ID,并稍后通过调用 findViewById(savedId) 来获取它。
What do you mean "save state"? For your purpose you need save only id of first view and get it later by calling
findViewById(savedId)
.