title: How to set width of view with respect to value in android
body: <p><a href="https://i.stack.imgur.com/tu3no.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tu3no.png" alt="enter image description here" /></a></p>
  <p>How to change the second view length according to value. If the first one value is 100 then the width is match_parent. If the second one value is 60 then how to set the width of that according to that one.</p>
  <pre><code>             &lt;RelativeLayout
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;match_parent&quot;
                  android:layout_marginTop=&quot;20dp&quot;
                  android:layout_below=&quot;@+id/headerproject&quot;&gt;
  
                  &lt;View
                      android:layout_width=&quot;match_parent&quot;
                      android:layout_height=&quot;5dp&quot;
                      android:background=&quot;@color/grey&quot;&gt;
                      
                  &lt;/View&gt;
                  
                  &lt;View
                      android:layout_width=&quot;200dp&quot;
                      android:layout_height=&quot;5dp&quot;
                      android:background=&quot;@color/colorPrimary&quot;
                      &gt;
                      
                  &lt;/View&gt;
              &lt;/RelativeLayout&gt;
  </code></pre>