title: Android Different Screen Size and Density
body: <p><strong><em>Question One</em></strong>: My application has 18-20 xml layout files. How can i make app same on all android phone. I read many answers creating different value folder for sizes and density but how can i achieve both things like some phone have different density but same screen size. and creating 7-8 files for each layout xml file i think will not be good.</p>
  
  <p>Please be specific do not reply the links of other questions or android developer site url. I have read all android doc and answers in stack overflow.</p>
  
  <p><strong><em>Question 2</em></strong>: in two activities im creating button at run time. i have created button according to density but what about size if size is big there is many blank white space left.</p>
  
  <pre><code>Resources r = getResources();
              int px = Math.round(TypedValue.applyDimension(
                      TypedValue.COMPLEX_UNIT_DIP, 150,r.getDisplayMetrics()));
  
  
              button.setWidth(px);   
              button.setHeight(px);  
  </code></pre>