title: android layout margins with percentage
body: <p>I want to set margins by percentage.. I have 4 imageviews in a linearlayout and want to set default left,right,top,bottom margins that keep same percentage for each screen size.</p>
  
  <p>is it possible ?</p>
  
  <p>here is a demo what i want..
  <img src="https://i.stack.imgur.com/SBCY5.png" alt="enter image description here"></p>
  
  <p>And here is what i've tried and doesn't work</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:weightSum="10" &gt;
  
          &lt;Thumbnail
              android:id="@+id/thumb1"
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="4" /&gt;
  
          &lt;Thumbnail
              android:id="@+id/thumb2"
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="4" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:weightSum="10" &gt;
  
           &lt;Thumbnail
               android:id="@+id/thumb3"
               android:layout_width="0dp"
               android:layout_height="match_parent"
               android:layout_weight="4" &gt;
           &lt;/Thumbnail&gt;
  
          &lt;Thumbnail
              android:id="@+id/thumb4"
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="4" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Thanks for your help</p>