Tuesday, February 25, 2014

Strange: LinearLayout follow-up can not append View member!


View the follow-up can not be added LinearLayout members

There is a strange phenomenon in the Activity's onCreate, give LinearLayout add group members, these members to show up in the back onWindowFocusChanged years, give LinearLayout add group members, they do not show up, but can be emptied removeAllView previously added members.

By invalidate or layout can not be displayed behind the members to add, in the end what is the reason?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
This onWindowFocusChanged confirm whether the method call.
LinearLayout will be able to add this addView childView, if you can not add the code that is written in a little problem,
Better to code stickers, look.
Reply:
Landlord calling addView () method which overloaded method when used?
Need to use addView (View child, ViewGroup.LayoutParams params) This, plus a params.
addView (View child) this seemingly impossible.
Reply:
Directly on the code, the landlord
Reply:
Seems to be added into it, getChildCount is correct, but it does not show up.

How to make layout again?
Reply:
Is not out of the screen, and look at it with the hierarchy view

No comments:

Post a Comment