multiple screen support

Posted by pedr0 on Stack Overflow See other posts from Stack Overflow or by pedr0
Published on 2011-01-05T15:32:35Z Indexed on 2011/01/05 15:53 UTC
Read the original article Hit count: 168

Filed under:
|

Hi at all,

I have some problem with multiple screen support, I work with dp(dpi) for specify the layout_heigth and layout_width and I hope that is the better way to support multiple screen, but when I tried with two smartphone I meet two different result.

I give an example, this is a layout I use:

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/cities_main_layout"
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent">

       <ListView
          android:id="@+id/citieslist"
          android:layout_width="wrap_content" 
          android:layout_height="320dip"
          android:layout_gravity="center_vertical"
          android:layout_below="@id/cities_main_layout"
       />

       <LinearLayout 
          android:id="@+id/cities_button_layout"
          android:orientation="horizontal"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@id/citieslist"
          android:layout_gravity="center_vertical">   
        <Button 
           android:id="@+id/bycountry"
           android:layout_height="50dip"
           android:layout_width="105dip"
           android:background="@drawable/buttonmarket"
           android:text="@string/button_bycountry"
          />
        <Button 
           android:id="@+id/top10"
           android:layout_height="50dip"
           android:layout_width="105dip"
           android:background="@drawable/buttonmarket"
           android:text="@string/button_top10"
          />
        <Button 
           android:id="@+id/recommended"
           android:layout_height="50dip"
           android:layout_width="105dip"
           android:background="@drawable/buttonmarket"
           android:text="@string/button_recommended"
          />

       </LinearLayout>

    </RelativeLayout>

The button are at the bottom of the layout, and I see two different result:

http://img600.imageshack.us/img600/5513/htcmagicg2.png

http://img441.imageshack.us/img441/6440/samsunggalaxys.png

In the last smartphone I can see the buttons, instead in the first I cannot...what's wrong?

I have to write a layout for any set of screen??!!!

© Stack Overflow or respective owner

Related posts about java

Related posts about android