Android: Redrawing a specific view inside a layout

10,490

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().

Share:
10,490
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin about 2 years

    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?