Android: Redrawing a specific view inside a layout
I have a vertically aligned LinearLayout which contains a TextView, my own custom view class, and i'm hoping to put an ad at the bottom.
I'm drawing objects in my custom view class (that extends View), but it does not get updated to the screen unless i call setContentView(R.layout.myview)
, but this resets my TextView to the default text (what is stored in the xml file) which i don't want, and i assume it would redraw a new ad as well... annoying.
Is there a 开发者_运维知识库way i can redraw/refresh my custom View to the screen without affecting my textview or whatever else i may have on my layout?
How about View.invalidate()
?
From the reference:
Note that the framework will not draw views that are not in the invalid region.
To force a view to draw, call invalidate().
精彩评论