Alessandro
Alessandro

Reputation: 15

Screen not getting updated

I know that Google engineers are taking some control in regards views layout and redrawing. But I can't understand way changing a view visibility doesn't update the screen. I have a peace of code that is strait forward:

if (editMode)
    mView.setVisibility(View.VISIBLE);
else
    mView.setVisibility(View.INVISIBLE);

The "mView" is a TableLayout view that shows its cells when the Activity is in edit mode. And hides it when the Activity is in normal mode. I tried to call "invalidate()" in the "mView" instance and on its parent (that is a FrameLayout), nothing worked. I suspected that could have something to do with the drawing cache so, I disabled it in the parent view (FrameLayout), and in the "mView" instance. I got no changes. Why a View is so stuck like that? What could I possibly doing wrong that the screen doesn't get updated?

Upvotes: 0

Views: 48

Answers (1)

Rohan Kandwal
Rohan Kandwal

Reputation: 9326

If by screen doesn't get updated you mean that there is an empty space where the view was once then that is because you made it invisible i.e. we can't see it but it's there. If want to remove that space then use View.GONE.

Upvotes: 3

Related Questions