title: How to make layout to be 80% of the width of the screen?
body: <p>How can I make some layout to be for example 80% or 90% of the width of the screen, no matter what is the screen size or DPI? I tried with " but I get 80% of the height then.</p>
  
  <p>EDIT:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:background="@drawable/background" &gt;
  
      &lt;Button
          android:id="@+id/bNivoi1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:layout_marginTop="80dp"
          android:background="@drawable/button_nivoi_back" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:weightSum="1"
          android:orientation="horizontal" &gt;
  
      &lt;TextView
          android:id="@+id/tvOpis15Nivoa"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:gravity="center"
          android:textSize="15sp"
          android:layout_weight="0.8"
          android:text="text" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I only need textview to be 80% of the screen, not the rest of the activity.</p>