2012-11-13 86 views
2

是否可以從存儲庫獲取字符串資源(如HashTableList等)而不是strings.xml?在佈局 期望使用像動態android字符串資源

<EditText android:id="@+id/inputSearch" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:hint="@StringRepository.GetMessage("Search")" 
     android:inputType="textVisiblePassword"/> 

我的挑戰是保持應用程序的服務器(Web)的字符串值,並刷新所有的字符串資源(包括佈局和Java方面)沒有版本更新。

我試圖遍歷onCreate方法Activity實例的所有視圖,但找不到動態創建視圖的解決方案。

任何有助於實現這一挑戰,將不勝感激。

回答

1

否。@resource語法僅適用於XML定義的資源。如果你想在一個hashmap中定義你的字符串,你需要在代碼中設置你的視圖的提示/文本。