动态的Android字符串资源 [英] Dynamic android string resources
问题描述
是否有可能从一个存储库(如的HashTable
,列表
等)而不是字符串得到的字符串资源。 XML?
像
Is it possible to get string resources from a repository (like HashTable
, List
etc. ) not strings.xml?
Desired usage in layouts like
<EditText android:id="@+id/inputSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@StringRepository.GetMessage("Search")"
android:inputType="textVisiblePassword"/>
我的挑战是没有版本更新维护应用程序服务器(网络)上的字符串值,并刷新所有的字符串资源(包括布局和Java方面)。
My challenge is maintain string values on application server (web) and refresh all string resources (both layout and java side) without version updating.
我试图穿越在活动
实例的onCreate
方法的所有意见,但无法找到一个解决方案动态创建的视图。
I tried to traverse all Views on onCreate
method of Activity
instance, but couldn't find a solution for dynamically created Views.
任何帮助实现这一挑战将是AP preciated。
Any help to achieve this challenge would be appreciated.
推荐答案
没有。在 @resource
语法只适用于XML定义的资源。如果你想在一个HashMap来定义你的字符串,你将需要设置在code你的观点的提示/文本。
No. The @resource
syntax only works with XML defined resources. If you want to define your strings in a hashmap, you will need to set the hint/text of your views in code.
这篇关于动态的Android字符串资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!