gpt4 book ai didi

Android层图像

转载 作者:行者123 更新时间:2023-11-29 20:14:05 25 4
gpt4 key购买 nike

我绘制了一组彼此重叠的图像,类似于 http://webhelp.esri.com/arcgisserver/9.3/java/geodatabases/data_themes_as_layers.gif每个图像都有透明区域和可点击区域。这个想法是要有一个带有可点击区域的车辆图像,当然有些区域是不可点击的,它们是透明的。

每张图片都是不同的格式:HDPI、MDPI、XHDPI、XXHDPI、XXXHDPI。渲染时它会导致某些设备崩溃,因为它耗尽了内存,所以显然我在这里做错了什么或者图像太大了?我确实检查了图像的大小,它们都符合规范。

我使用的布局:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScreenLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/BASE"
android:tag="-1"
android:src="@drawable/car_base_right"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B1"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B1_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B2"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B2_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B3"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B3_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B4"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B4_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B5"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B5_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B6"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B6_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B7"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B7_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B8"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B8_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B9"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B9_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B10"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B10_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/car_B11"
android:tag="0"
android:background="@android:color/transparent"
android:src="@drawable/car_B11_green"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

最佳答案

You are dealing with large images and loading all of them at run time. You have to deal very carefully with large images by loading the size that you need not the whole images at once and then do scaling.

解决方案

  1. 减小图像尺寸和分辨率。
  2. android:largeHeap=”true” list 文件中的标志。

关于Android层图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34307449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com