My layout sometimes does not position elements properly. I tried a lot of solutions but unique working one is rotate from portrait to landscape and then return from landscape to portrait. Then layout is automaticaly redrawed and fits perfectly. I set orientation|keyboard so content is not reloaded, only redrawed. How to redraw content programmaticaly like landscape-portrait does? Thank you.
EDIT: I tried following and has no effect
getWindow().getDecorView().findViewById(android.R.id.content).invalidate();
getWindow().getDecorView().findViewById(android.R.id.content).requestLayout();
Activity has set main layout on onCreate setContentView(R.layout.main);
Layout “main” contains a TabHost and Admob.
Layout “view” contains a webview (“id:myWebview”) that is shown on tab1.
And also tried to invalidate them! webview, layout main and layout view and crashes
Did you try to
invalidate()the root view?This should redraw the whole layout.