Hi all,
I'm new to android and xml ui layouts, so please bare with me. What
I'm trying to do is a relative layout with an imageview above and a
nested tablelayout below with 4 rows containing 4 buttons in each row.
Like this:
______________
|                       |
|                       |
|      Image        |
|                       |
|_____________|
|___|___|___|___|
|___|___|___|___|
|___|___|___|___|
|___|___|___|___|

Where the buttons only display 1 character each. The problem I'm
having is that the buttons come out tiny no matter what setting I use
for width and height (i.e. fill_parent or wrap_content). Also the last
row of buttons goes off the bottom of the screen. Should I be
declaring actual sizes for everything? I want the app to scale
correctly if the screen size should change. I want nice finger sized
buttons that utilize the bottom half of the screen well. My current
xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android";
>
<ImageView
android:id="@+id/image1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/imagefile"
android:layout_gravity="center_horizontal"
>
</ImageView>
<TableLayout
android:id="@+id/widget37"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@id/image1"
android:layout_weight="1"
android:layout_gravity="center_horizontal"
>
<TableRow
android:id="@+id/widget42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/button7"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="7"
>
</Button>
<Button
android:id="@+id/button8"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="8"
>
</Button>
<Button
android:id="@+id/button9"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="9"
>
</Button>
<Button
android:id="@+id/dividebutton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="/"
>
</Button>
</TableRow>
<TableRow
android:id="@+id/widget45"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4"
>
</Button>
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
>
</Button>
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
>
</Button>
<Button
android:id="@+id/multiplybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x"
>
</Button>
</TableRow>
<TableRow
android:id="@+id/widget44"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
>
</Button>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
>
</Button>
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
>
</Button>
<Button
android:id="@+id/minusbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
>
</Button>
</TableRow>
<TableRow
android:id="@+id/widget43"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/button0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
>
</Button>
<Button
android:id="@+id/decimalbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="."
>
</Button>
<Button
android:id="@+id/equalsbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="="
>
</Button>
<Button
android:id="@+id/plusbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
>
</Button>
</TableRow>
</TableLayout>
</RelativeLayout>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to