Android, how to make two buttons next to each other with the same width

Posted by user3674127 on Stack Overflow See other posts from Stack Overflow or by user3674127
Published on 2014-08-20T16:18:20Z Indexed on 2014/08/20 16:20 UTC
Read the original article Hit count: 174

Filed under:
|

Im trying to place two buttons on the xml next to each other and I want them both to be the same size(half from the width of the screen) - this is my xml:

<LinearLayout
        android:layout_width="fill_parent"
        android:orientation="horizontal"
        android:id="@+id/linearLayout2"
        android:layout_height="fill_parent"
        android:gravity="bottom"
        android:weightSum="2">
    <Button
        android:layout_weight="1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/bAddDelete"
        />

    <Button
        android:layout_weight="1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/bMainMenu"
         />
</LinearLayout>

Everything works well, but when im changing the text in java, the width is changing, how can I make them the same size?

Thanks

© Stack Overflow or respective owner

Related posts about android

Related posts about Xml