Android: View.setID(int id) programmatically - how to avoid ID conflicts?

前端 未结 15 2527
眼角桃花
眼角桃花 2020-11-21 22:53

I\'m adding TextViews programmatically in a for-loop and add them to an ArrayList.

How do I use TextView.setId(int id)? What Integer ID do I come up wit

15条回答
  •  青春惊慌失措
    2020-11-21 23:38

    Also you can define ids.xml in res/values. You can see an exact example in android's sample code.

    samples/ApiDemos/src/com/example/android/apis/RadioGroup1.java
    samples/ApiDemp/res/values/ids.xml
    

提交回复
热议问题