title: android:layout_height 50% of the screen size
body: <p>I just implemented a ListView inside a LinearLayout, but I need to define the height of the LinearLayout (it has to be 50% of the screen height).</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/widget34"
      android:layout_width="300px"
      android:layout_height="235px"
      android:orientation="vertical"
      android:layout_below="@+id/tv_scanning_for"
      android:layout_centerHorizontal="true"&gt;
  
      &lt;ListView
          android:id="@+id/lv_events"
          android:textSize="18sp"         
          android:cacheColorHint="#00000000"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/tv_scanning_for"
          android:layout_centerHorizontal="true"&gt;
      &lt;/ListView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Is that possible?</p>
  
  <p>I did something similar for a button and an EditText, but doesn't seem to work on Layouts.</p>
  
  <p>This is my Code:</p>
  
  <pre><code>    //capture the size of the devices screen
      Display display = getWindowManager().getDefaultDisplay();
      double width = display.getWidth();
  
      //my EditText will be smaller than full screen (80%)        
      double doubleSize = (width/5)*4;
      int editTextSize = (int) doubleSize;
  
      //define the EditText 
      userName = (EditText) this.findViewById(R.id.userName);
      password = (EditText) this.findViewById(R.id.password);
  
      //set the size
      userName.setWidth(editTextSize);
      password.setWidth(editTextSize);
  </code></pre>