平板电脑上的图像模糊

时间:2016-03-26 21:18:23

标签: android android-layout

我开发了一个带图像的应用程序,但是,当我从平板电脑运行应用程序时,图像看起来很模糊。平板电脑尺寸为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>

1 个答案:

答案 0 :(得分:0)

您正在为ImageButton图片应用显式尺寸,而未定义基础ScaleType将用于将其缩放到该尺寸的ImageView

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

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

  1. 在布局宽度和高度中使用wrap_content
  2. 使用ScaleType
  3. center
  4. 使用较大的图片,这样您就不需要进行缩放。
相关问题