【问题标题】:Supporting multiple screens on Android; background image problem支持安卓多屏;背景图片问题
【发布时间】:2011-06-21 15:10:54
【问题描述】:

我正在创建一个需要背景图像的应用程序。我已阅读有关如何执行此操作的 android 开发人员指南,并以三种不同的 DPI 创建了图像; 120,160,240。中小 dpi 图像工作,240 图像被奇怪地拉伸。这仅适用于 1 分辨率 240*320,当我在更大的屏幕上尝试时,我的图像再次被拉伸。我的布局由重复的背景图案图像、遥控器图像和图像按钮组成。 http://dl.dropbox.com/u/16826969/layout.png 我无法定位我的按钮,使其在每个屏幕(位置)上看起来都一样。 我也尝试过drawable-nodpi,并制作了一个屏幕大小的图像,认为它在更大的屏幕上会很好......好吧它不是...... 你能帮帮我吗,我可以阅读任何书籍或教程吗?我可以通过任何示例吗?

 <?xml version="1.0" encoding="utf-8" ?>
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@layout/backrepeat" android:focusable="false">
<ImageView android:layout_width="match_parent"  android:background="@drawable/remotedpi"
    android:id="@+id/imageView1" android:layout_height="wrap_content" android:scaleType="fitEnd"/>
<ImageView android:layout_marginBottom="10dip"
    android:layout_marginRight="25dip" android:id="@+id/ButtonTestPlay"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:src="@drawable/play" android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true" />
<ImageView android:layout_marginBottom="10dip"
    android:layout_marginLeft="25dip" android:id="@+id/ButtonTestPause"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:src="@drawable/stop" android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true" />
<ImageView android:id="@+id/ButtonStatus"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:src="@drawable/stop_hover" android:layout_alignParentLeft="true"
    android:layout_marginLeft="23dip" android:layout_marginTop="105dip" />
 </RelativeLayout>

编辑:我已经阅读了支持多种屏幕尺寸的文章 我也试过 9patch 图像,但我的遥控器图像是内容,我不想拉伸任何东西

我需要为每个 dpi 的每个分辨率制作一个图像吗? 例如:320*240 160 dpi、480*880 160 dpi 在可绘制 mdpi 文件夹中 以及 hdpi 文件夹中的 240 dpi 图片。

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-30
    相关资源
    最近更新 更多