Set width of Button in Android

Posted by Mohit Deshpande on Stack Overflow See other posts from Stack Overflow or by Mohit Deshpande
Published on 2010-05-09T00:54:16Z Indexed on 2010/05/09 0:58 UTC
Read the original article Hit count: 1534

Filed under:
|
|
|

How can I set a fixed width for an Android button? Everytime I try to set a fixed width it fills the current parent (the RelativeView). Here is my XML:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout android:id="@+id/relativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">

    <EditText android:layout_height="wrap_content" android:editable="false" android:layout_width="fill_parent" android:id="@+id/output"></EditText>

    <Button android:layout_height="wrap_content" android:id="@+id/Button01" android:layout_below="@id/output" android:text="7" android:layout_width="wrap_content"></Button>
    <Button android:layout_below="@id/output" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Button02" android:layout_toRightOf="@+id/Button01" android:text="8"></Button>
    <Button android:layout_below="@id/output" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Button03" android:layout_toRightOf="@+id/Button02" android:text="9"></Button>
</RelativeLayout>

How would I give it a FIXED width?

© Stack Overflow or respective owner

Related posts about size

Related posts about android