我正在写一个应用程序,我希望我的一项活动具有背景,

我已经阅读了有关支持多种分辨率等的Android文档,但是我的设计师问我壁纸应该是多少,我不希望在所有屏幕尺寸的低,正常,高的DPI上进行很多图像。

在所有这些屏幕上获得一个漂亮的屏幕填充图形背景的最有效的方法是什么?

Android很棒,而且一切都很棒,但是我不想最终获得一个巨大的应用程序,因为我需要所有内容的所有尺寸图像。

有帮助吗?

解决方案

一种方法是设计密度并使用 图标设计指南 对于图标,以及在“屏幕范围支持多个屏幕 背景图像指南。

对于背景图像,请确保考虑状态栏维度。

您可以将资源放入适当的可绘制的MDPI,可绘制的HDPI,可绘制的dlpi文件夹中,并将适当使用它们。

其他提示

只有一个高分辨率的景观背景并使用“拉伸”策略进行显示又如何呢?

    mBackgroundGraphic = BitmapFactory.decodeResource(getResources(), R.drawable.background);
    mBackgroundGraphic = getResizedBitmap(mBackgroundGraphic);

public Bitmap getResizedBitmap(Bitmap bm) {
    int width = bm.getWidth();
    int height = bm.getHeight();
    int displayWidth = mDisplay.getWidth();
    int displayHeight = mDisplay.getHeight();
    float scaleWidth = ((float) displayWidth) / width;
    float scaleHeight = ((float) displayHeight) / height;

    // Create a matrix for the manipulation
    Matrix matrix = new Matrix();

    // Resize the bit map
    matrix.postScale(scaleWidth, scaleHeight);

    // Return the new stretched Bitmap
    return Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top