本文介绍了多屏支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题,多屏幕支持,我和DP(dpi)的工作指定layout_heigth和layout_width,我希望是更好的方式来支持多屏幕,但是当我试图用两个智能手机我满足两个不同的结果

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:

在过去的智能手机,我可以看到的按钮,而不是在第一个我不能......什么问题?

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

推荐答案

您的ListView有

Your ListView has

android:layout_height="320dip"

现在,如果手机屏幕较小,它不适合。

Now if the phone screen is smaller, it will not fit.

尝试这样做,而不是:(编辑因评论这显示correcty在eclipse)

Try doing this instead: (Edited due to comments. This is displayed correcty in eclipse)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
    android:id="@+id/listview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF0000"
    android:layout_above="@+id/linlay">
</ListView>
<LinearLayout
    android:id="@+id/linlay"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="30dip"
    android:background="#00FF00"
    android:layout_alignParentBottom="true">
</LinearLayout>
</RelativeLayout>

吴丹应该修复它,我认为。

Thant should fix it I think.

干杯

这篇关于多屏支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 00:44