Setting up RelativeLayout in java code

后端 未结 3 1935
我寻月下人不归
我寻月下人不归 2021-01-12 05:35

I\'m having a hard time getting two text views to appear on top of each other in my java code. Here\'s the code I\'m experimenting with:

/** Called when the          


        
3条回答
  •  Happy的楠姐
    2021-01-12 05:57

    Your TextViews don't have an id (by default the id is -1)... put this after their initialization:

    text1.setId(1111); // 1111 is just an example,
    text2.setId(2222); // just make sure the id are unique
    

提交回复
热议问题