-1

您好,我正在使用为 M1 机器创建的模拟器https://github.com/google/android-emulator-m1-preview。我从moviesApi获取海报路径。但是在其他设备中,它们在recyclerview中绘制得很好,当我在我的moto g6中模拟它时,也会发生这个问题。

在此处输入图像描述

显示的图像是在 xml 中设置的图像,如下所示。

  <ImageView
                android:id="@+id/rv_image_movie"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:background="@drawable/movies_noimage"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

            </ImageView>

改造响应是完美的,正如我评论的那样,它适用于其他模拟器 api 26 27 28 任何你命名的。但是在这个和 motog6 中不起作用肯定是有问题。

这是最终的结果!

这很奇怪,因为在 m1 支持的模拟器中,我的 rick and morty 应用程序完美地显示了图像。

在此处输入图像描述

4

1 回答 1

-1

好的,我找到了答案,它可能会帮助很多人。要解决此问题,您需要在您的 android 清单中添加...

  <uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

<application
    android:name=".MovieApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:usesCleartextTraffic="true"

    android:theme="@style/Theme.MoviesDBKotlin">
    <activity
        android:name=".ui.MainActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.MoviesDBKotlin">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

添加 android:usesCleartextTraffic="true" 将解决模拟器问题,在我的情况下与滑翔有关,我认为是这样。享受!!。

于 2021-01-17T05:39:47.300 回答