【问题标题】:android app design looks different on lollipop than marshmallow棒棒糖上的安卓应用程序设计看起来与棉花糖不同
【发布时间】:2017-02-05 12:04:16
【问题描述】:

我的应用程序使用带有图标和文本的选项卡。

在 Marshmallow 上,图标看起来不错,但在 Lollipop 中却不行。

你能帮忙吗?

这是棉花糖(和牛轧糖)上的样子:

这是它在 Lollipop 上的样子:

我应该提到图标是作为可绘制对象添加的。

<?xml version="1.0" encoding="utf-8"?>
<layer-list
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto">
      <item android:drawable="@drawable/myicon75x75"
            android:gravity="top"
            android:height="30dp"
            android:width="30dp" >
      </item>
</layer-list>

【问题讨论】:

  • 这是您设备分辨率的问题。在 hdpi、mdpi、xhdpi 和 xxhdpi 中添加多个尺寸的图像,问题将得到解决。在分辨率更改时,设备会尝试自动调整图像,这里我们需要多个尺寸的图像来保存我们的应用程序,使其在不同设备中看起来很难看
  • 使用您的评论作为答案,我会接受它作为选定答案!

标签: android-layout android-6.0-marshmallow android-5.1.1-lollipop


【解决方案1】:

为了让您的应用程序中的图像支持多种屏幕尺寸,您需要将多种尺寸的图像放在您的可绘制文件夹中。 例如,drawable-hdpi、drawable-mdpi、drawable-xhdpi、drawable-xxhdpi,并将正确的图像放在相应的文件夹中。
现在,即使您设备的屏幕分辨率发生变化,您的应用程序图像也不会受到影响。
此外,您还可以从this link 轻松获得多种尺寸的图标。

【讨论】:

    猜你喜欢
    • 2016-05-02
    • 1970-01-01
    • 2016-07-30
    • 2016-09-26
    • 1970-01-01
    • 2016-10-17
    • 2017-01-28
    • 1970-01-01
    相关资源
    最近更新 更多