views:

45

answers:

0

Hey, I currently have four buttons placed in a keypad-like arrangement in an AbsoluteLayout.

<AbsoluteLayout
            android:id="@+id/WalkingTabView"
            android:orientation="vertical"
            android:gravity="center_vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
                <ImageButton
                    android:id="@+id/WalkForwardButton"
                    android:layout_width="100dip"
                    android:layout_height="100dip"
                    android:layout_x="110dip"
                    android:layout_y="40dip"
                    android:src="@drawable/up_arrow" />
                <ImageButton
                    android:id="@+id/TurnRightButton"
                    android:layout_width="100dip"
                    android:layout_height="100dip"
                    android:layout_x="210dip"
                    android:layout_y="140dip"
                    android:src="@drawable/right_arrow" />
                <ImageButton
                    android:id="@+id/WalkBackwardButton"
                    android:layout_width="100dip"
                    android:layout_height="100dip"
                    android:layout_x="110dip"
                    android:layout_y="240dip"
                    android:src="@drawable/down_arrow" />
                <ImageButton
                    android:id="@+id/TurnLeftButton"
                    android:layout_width="100dip"
                    android:layout_height="100dip"
                    android:layout_x="10dip"
                    android:layout_y="140dip"
                    android:src="@drawable/left_arrow" />
                <ImageButton
                    android:id="@+id/StopButton"
                    android:layout_width="100dip"
                    android:layout_height="100dip"
                    android:layout_x="110dip"
                    android:layout_y="140dip"
                    android:src="@drawable/stop_square" />
        </AbsoluteLayout>

This looks fine in the emulator at HVGA resolution, however if I change it to another it's either cut off or has a lot of space left behind [link]. I've heard this can be solved by using a RelativeLayout, but I don't really understand how to use them in my situation. Basically what I want to be able to do is center the buttons in whatever screen resolution the phone uses, and possibly resize them accordingly too.