Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make button to fill 50% from the screen width in android?

Tags:

android

I want to make the button to fill always 50% from the width of the screen, as when I rotate the device horizontally or vertically always the button fill 50% from the width.

like image 778
Adham Avatar asked Jan 03 '11 21:01

Adham


People also ask

How do I make the buttons bigger on my android?

Tap the Gear icon that appears at the top of the Android keyboard. Open Preferences. Tap the Keyboard Height option. You'll see seven different options ranging from "Extra-short" to "Extra-tall." The default is "Normal." Tap the option you prefer.

What is layout width and height in android?

android:layout_height. Specifies the basic height of the view. android:layout_width. Specifies the basic width of the view.


1 Answers

This should be possible by using weightSum and layout_weight:

<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_height="wrap_content"  android:layout_width="fill_parent"  android:orientation="horizontal"  android:weightSum="1.0">  <Button   android:id="@+id/textbox3"   android:layout_height="wrap_content"   android:layout_weight=".5"   android:layout_width="0dip"   android:textSize="12sp" /> </LinearLayout> 
like image 115
RoflcoptrException Avatar answered Sep 29 '22 16:09

RoflcoptrException