java - 在 Android studio 中,我的所有图标都很模糊,我不明白为什么

标签 java android xml user-interface

在 Android Studio 中,我的应用程序图标变得模糊,我不明白为什么。我用草图制作了所有的图标。有没有人在上传图标时遵循分步流程,以确保它们对于所有手机尺寸都清晰且美观?

这是我的屏幕外观的链接: /image/CgoGV.jpg

这是我的 XML 文件的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context="com.example.leoconnelly.connexus.MainActivity">

<LinearLayout
    android:id="@+id/ll_learn"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_gravity="center_vertical"
    android:layout_weight="1">

    <ImageButton
        android:id="@+id/learn"
        android:layout_width="match_parent"
        android:scaleType="centerCrop"
        android:src="@mipmap/learn_tab_button"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:padding="0dp"
        android:layout_weight="1"
        android:text="@string/learn"
        android:textSize="22sp"
       />





</LinearLayout>

<LinearLayout
    android:id="@+id/ll_find_care"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_gravity="center_vertical">

    <ImageButton
        android:id="@+id/find_care_button"
        android:layout_width="match_parent"
        android:scaleType="centerCrop"
        android:src="@mipmap/find_care_layer_button"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:padding="0dp"
        android:layout_weight="1"
        android:text="@string/learn"
        android:textSize="22sp" />

</LinearLayout>

<LinearLayout
    android:id="@+id/ll_talk_to_doctor"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_gravity="center_vertical">

    <ImageButton
        android:id="@+id/TalkToADocButton"

        android:layout_width="match_parent"
        android:scaleType="centerCrop"
        android:src="@mipmap/talk_to_a_doctor_new_font_button"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:padding="0dp"
        android:layout_weight="1"
        android:textSize="22sp" />


</LinearLayout>

<LinearLayout
    android:id="@+id/ll_visit_website"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_gravity="center_vertical">

    <ImageButton
        android:id="@+id/VisitWeb"
        android:layout_width="match_parent"
        android:scaleType="centerCrop"

        android:src="@mipmap/visit_web_icon_new_font_button"

        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:padding="0dp"
        android:layout_weight="1"
        android:textSize="22sp" />

</LinearLayout>

最佳答案

可能是因为您的图像资源密度不适合您的屏幕密度。 检查您的图像资源文件是否已正确位于文件夹(mdpi、hdpi、xhdpi、xxhdpi、xxxhdpi)中。最小的图像位于 mdpi 文件夹中,最大的图像位于 xxxhdpi 文件夹中。 确保您将不同尺寸的相同图片按图像尺寸划分到文件夹(mdpi、hdpi、xhdpi、xxhdpi、xxxhdpi)中。

图像尺寸比例:

1) mdpi 文件夹中的图像为 1dp == 1px

2) hdpi 文件夹中的图像为 1dp == 1.5px

3) xhdpi 文件夹中的图像为 1dp == 2px

4) xxhdpi 文件夹中的图像为 1dp == 3px

按该比例调整最大图像的大小并将其放置在正确的文件夹中

关于java - 在 Android studio 中,我的所有图标都很模糊,我不明白为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50650227/

相关文章:

android - AsyncTask,Insert,在 Android 中选择错误的执行顺序

xml - 如何使用 powershell 更新 [xml] 属性中的字符串?

xml - XPath 如何处理 XML 命名空间?

java - 使用 Stax Parser 将大于 10GB 的巨大 xml 文件拆分成小块

java - 为什么 WebView -> onPause 只在第一次工作?

java - Jackson 反序列化,有 2 个字段自引用同一个类(自引用循环)

java - 错误:Execution failed for task ':app:transformClassesWithAndroidGradleClassShrinkerForDebug'

android - 使用tesseract使用android提取图像中的文本时出错

java - 我怎样才能在我的程序中用单词输出百位和十位数字

Android - 如何对 GridView 项目产生链式 react ?