如何從資源 id 中獲取資源名稱 - How to get Resource Name from Resource id

問題:


In my layout I have defined something like this .在我的佈局中,我定義了這樣的東西。

<RadioButton
    android:id="@+id/radio1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Dnt want this text" />

Assume that some function in activity returns me this id (id of radioButton).假設活動中的某個函數向我返回這個 id(radioButton 的 id)。 Now i want to get this text radio1 from this id.現在我想從這個 id 獲取這個文本radio1 In short I want to retrieve text radio1 written in android:id="@+id/radio1"總之,我想檢索用android:id="@+id/radio1"編寫的文本radio1

Can somebody tell me how is it possible ?有人能告訴我怎麼可能嗎?


解決方案:

參考一: https://en.stackoom.com/question/gXHA
參考二: https://stackoom.com/question/gXHA
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章