【问题标题】:Android icons get stretched on Samsung deviceAndroid 图标在三星设备上被拉伸
【发布时间】:2014-06-03 14:20:38
【问题描述】:

我已经使用我的自定义图像开发了几个使用 android 图标集的操作栏和选项卡图标,并将它们用作按钮背景。它们在手机上看起来不错,但是当我在三星 Galaxy Tab 7 上进行测试时,它们会感到拉伸和模糊。

我尝试制作文件夹 layout-sw600dp 和 layout-large 但没有区别。

其中一个图标:

 <ImageButton
        android:id="@+id/button_settings"
        android:layout_width="64dp" 
        android:layout_height="64dp"
        android:background="@drawable/settings_custom"
        android:focusable="true"
        android:contentDescription="@string/settings"/>

settings_custom.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/ic_action_app_sett" android:state_pressed="true"/>
    <item android:drawable="@drawable/ic_action_app_sett"/>

</selector>

谁能帮我看看我哪里错了?谢谢!

【问题讨论】:

  • 首先,似乎只有在API Level 13之后才添加名为layout-sw600dp的文件夹,其次-您确定设备的最小宽度为600 dp吗? (developer.android.com/guide/practices/…) 我的意思是我有一个华硕 MemoPad 7,但我认为它没有 600dp 的宽度。 7”和1280x800分辨率。另外,你应该在drawable-xhdpi、hdpi、mdpi、ldpi等中添加不同大小的“图标”。
  • 您可以将此自定义图像视图集成到任何尺寸,您可以查看此示例github.com/matabii/scale-imageview-android

标签: android xml android-layout icons android-drawable


【解决方案1】:

尝试设置 android:src="@drawable/settings_custom" ,对于 7 英寸选项卡,您需要将该分辨率的图像放在 drawable-large-mdpi 文件夹下,请通过以下链接了解更多关于 android 支持多个屏幕, http://developer.android.com/guide/practices/screens_support.html

【讨论】:

  • 谢谢。使 drawable-large-mdpi 文件夹工作。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多