PDA

View Full Version : Another problem with button layout...


rvaul
11-01-2009, 09:57 PM
So I'm trying to create a simple "point-and-click-change-image" style app. I made my own custom buttons, and the only problem I'm having is with the layout of the buttons. I would like the "left" button in the upper left hand corner, and the "right" button in the upper right hand corner.

Now, putting each of my buttons in it's own layout seems to make the buttons "disappear", and adding any weight or gravity to either of them seems to stretch them WAY out, even if I change the width from "wrap_content" over to "40px", (the width of the button).

This is my XML layout from one of the screens. (I know this is wrong, but I can't find the right way either ;) )


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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/pic1">

<Button android:id="@+id/Button01"
android:background="@drawable/buttonleft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left">
</Button>

<Button android:id="@+id/Button02"
android:background="@drawable/buttonright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">
</Button>

</LinearLayout>




Thank you for any help.