Home > Mobile >  The android ViewGroup. The problem of addView method
The android ViewGroup. The problem of addView method

Time:10-06

1, through infater. Infate (R.l ayout. XXX, the parent, false) to create a View
2, father parent layout through addView method add 1 to create a View to the layout inside the
3, through 1 to create the View there are two controls (TextView and ImageView),
The first call to TextView set to visible, ImageView set to invisible
The second call will TextView set to invisible, visible ImageView set to

Question: after the second call, the TextView would not visible, but it didn't set up a visible ImageView to interface,
The ImageView high and wide left, top, right, bottom print it out, found that is 0, is this why?????? A great god, please answer

CodePudding user response:

Method no problem, the need to have a look at the layout XXX

CodePudding user response:

Try to infater. Infate (R.l ayout. XXX, null, false)

CodePudding user response:

refer to the second floor Xzmpyy response:
try to infater. Infate (R.l ayout. XXX, null, false)

Thank you, the problem has been solved, addview increase when the layout is ok
  • Related