The better way is to change visibility of views instead of remove and add to container. It will work faster and view with visibility gone will not redraw on invalidate.
view.invalidate invokes redraw of other view
-
18-07-2023 - |
Question
If I invalidate view1 then my view2 is redrawn. I like to only redraw my view1.
I have: 2 Custom Views -> view1 & view2 1 LinearLayout
I visually switch between the view1 and view2 with:
LinearLayout.removeAllViews();
LinearLayout.addView(view2) or LinearLayout.addView(view1);
How can I invalidate view1 without triggering the drawing of view2 ?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow