06 Jul 2011, 17:48
Manny zs_pragsmall

Jason Strader (9 posts)

I have a problem with landscape I’m trying to make my buttons all fit on the screen but I can’t see the exit button.

Here is my code under landscape.xml

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout 
        xmlns:android="http://schemas.android.com/apk/res/android" 
        android:background="@color/background" 
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:padding="15dip" 
        android:orientation="horizontal">

        <LinearLayout

            android:orientation="vertical" 
            android:layout_height="wrap_content" 
            android:layout_width="fill_parent" 
            android:layout_gravity="center" 
            android:paddingLeft="20dip" 
            android:paddingRight="20dip">

            <TextView
                android:text="@string/main_title" 
                android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:layout_gravity="center" 
                android:layout_marginBottom="20dip" 
                android:textSize="24.5sp" />

                <TableLayout
                android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:layout_gravity="center" 
                android:strechColums="*">

        <TableRow>
            <Button
                android:id="@+id/continue_button" 
                android:text="@string/continue_label" />
            <Button
                android:id="@+id/new_button" 
                android:text="@string/new_game" />
                </TableRow>

                <TableRow>
            <Button
                android:id="@+id/about_button" 
                android:text="@string/about_label" /> 
            <Button
                android:id="@+id/exit_button" 
                android:text="@string/exit_label" />
                </TableRow>
                </TableLayout>
        </LinearLayout>
</LinearLayout> 
08 Jul 2011, 15:47
Burnette_ed_pragsmall

Ed Burnette (1316 posts)

When you say landscape.xml do you mean res/layout-land/main.xml? That’s what the file should be named, assuming the regular portrait version is in res/layout/main.xml .

Also android:strechColums should be spelled android:stretchColumns .

And in my original version android:text=”@string/new_game” was android:text=”@string/new_game_label” (you can use whatever you want, just make sure it matches the name you gave it in res/values/strings.xml.

08 Jul 2011, 21:21
Manny zs_pragsmall

Jason Strader (9 posts)

Got it thanks!

09 Jul 2011, 21:45
Burnette_ed_pragsmall

Ed Burnette (1316 posts)

No problem.

  You must be logged in to comment