title: android redraw layout programmatically
body: <p>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.</p>
  
  <p>EDIT: I tried following and has no effect</p>
  
  <pre><code>getWindow().getDecorView().findViewById(android.R.id.content).invalidate();
  getWindow().getDecorView().findViewById(android.R.id.content).requestLayout();
  </code></pre>
  
  <p>Activity has set main layout on onCreate <code>setContentView(R.layout.main);</code> </p>
  
  <p>Layout "main" contains a TabHost and Admob.
  Layout "view" contains a webview ("id:myWebview") that is shown on tab1.</p>
  
  <p>And also tried to invalidate them! webview, layout main and layout view and crashes</p>