Hello,

thanks for your answer. Meanwhile I found a very satisfying solution.
In my layout xml I used scaled-independend pixels:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
                <my.domain.GamePanelView
                      android:id="@+id/game"
                      android:layout_width="320sp"
                      android:layout_height="350sp"
                      
android:layout_gravity="center_vertical|center_horizontal"/>

                <TableLayout
                    android:id="@+id/tableLayout"
                        android:layout_width="320sp"
                        android:layout_height="fill_parent"
                        android:layout_gravity="center_horizontal"
                        android:gravity="bottom"
                        android:stretchColumns="*"
                        android:layout_alignParentBottom="true">
                        <TableRow>
                    <Button
                        android:id="@+id/btnUp"
                        android:layout_width="50sp"
                        android:layout_height="40sp"
                        android:text="Up"
                        />
                    <Button
                        android:id="@+id/btnEnter"
                        android:layout_height="40sp"
                        android:text="Enter"
                        />
                    <Button
                        android:id="@+id/btnDown"
                        android:layout_width="50sp"
                        android:layout_height="40sp"
                        android:text="Down"
                        />
                    </TableRow>
        </TableLayout>
</LinearLayout>

So the button bar is always dynamic and the "game panel" static. In
this case static means, that it grows or shrinks depending on the
density due to the scaled pixel. In the code I just get the density
value from DisplayMetrics and use it as multiplier for the motion of
the graphic. This works great in every tested screen size. No matter
which density or screen size, the game panel and the motion of the
graphic is always in the correct ratio.

Regards.

-- 
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to