【问题标题】:images are blurry on tablet平板电脑上的图像模糊
【发布时间】:2016-03-26 21:18:22
【问题描述】:

我开发了一个带有图像的应用程序,但是当我从平板电脑运行应用程序时,图像看起来很模糊。平板电脑大小为 10.1。

当我在移动设备上运行该应用程序时,它的工作原理就像是魅力一样,请您告诉我为什么平板电脑上的图片看起来很模糊。我创建了可绘制文件夹

对于每个不同的屏幕尺寸也没有解决问题。请问您能提供帮助或建议吗?。

我的 Drawable 文件夹结构和大小

  • drawable-hdpi - 宽 62 x 高 62
  • drawable- mdpi - 宽 40 x 高 40
  • drawable-xhdpi - 宽 82 x 高 82
  • drawable - xxhdpi - 宽度 123 x 高度 123
  • drawable- xxxhdpi - 宽度 164 x 高度 164

这样对吗,请指教?

<ImageButton
        android:layout_width="150dp"
        android:layout_height="100dp"
        android:id="@+id/placesbtn"
        android:src="@drawable/ic_place"
        android:background="#00000000"
        android:layout_marginLeft="83dp"
        android:layout_marginStart="83dp"
        android:layout_below="@+id/flipper1"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:contentDescription="Places"
        android:focusable="true"  />

    <ImageButton
        android:layout_width="150dp"
        android:layout_height="100dp"
        android:id="@+id/transportbtn"
        android:src="@drawable/ic_travels"
        android:background="#00000000"
        android:layout_alignTop="@+id/placesbtn"
        android:layout_toRightOf="@+id/placesbtn"
        android:layout_toEndOf="@+id/placesbtn"
        android:focusable="true"
        android:contentDescription="Travel" />

    <ImageButton
        android:layout_width="150dp"
        android:layout_height="100dp"
        android:id="@+id/directionbtn"
        android:src="@drawable/ic_direction"
        android:background="#00000000"
        android:layout_alignParentBottom="true"
        android:layout_alignLeft="@+id/placesbtn"
        android:layout_alignStart="@+id/placesbtn"
        android:focusable="true"
        android:contentDescription="Direction"  />

    <ImageButton
        android:layout_width="150dp"
        android:layout_height="100dp"
        android:id="@+id/gallerybtn"
        android:src="@drawable/ic_gallerys"
        android:background="#00000000"
        android:layout_alignTop="@+id/directionbtn"
        android:layout_toRightOf="@+id/directionbtn"
        android:layout_toEndOf="@+id/directionbtn"
        android:focusable="true"
        android:contentDescription="Gallery" />

</RelativeLayout>

【问题讨论】:

  • 将你的帖子整理到我创建的表格中,这样的格式很难阅读
  • 您创建了哪个表。
  • 还有哪些图像是模糊的?是您的应用图标还是什么?
  • imagebuttons,我现在把它们放在问题部分。请帮忙?
  • 您找到解决方案了吗?我有同样的问题

标签: android android-layout


【解决方案1】:

您正在对 ImageButton 图像应用显式尺寸,而没有定义 ScaleType,底层 ImageView 将使用它们将它们缩放到该尺寸。

http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

您应该执行以下操作之一:

  1. 在布局宽度和高度中使用 wrap_content
  2. 使用ScaleTypecenter
  3. 使用较大的图片,这样您就不需要放大它们。

【讨论】:

  • 你能给我一个例子,说明我应该使用什么尺寸的图片。
  • 您将图像强制为 150x100dp,因此这似乎是一个不错的起点。您的图像是 40x40dp,因此它们被放大到 150x100dp。
猜你喜欢
  • 2016-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-01
  • 2013-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多