亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

帶有多個圖像的幻燈片放映?

帶有多個圖像的幻燈片放映?

慕容708150 2022-07-20 15:48:10
我想在幻燈片上制作具有不同圖像的應用程序,我的代碼如下:    @NonNull@Overridepublic Object instantiateItem(@NonNull ViewGroup container, int position) {    inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);    View view = inflater.inflate(R.layout.swipe, container, false);    ImageView imageView = view.findViewById(R.id.swipe_imageView);    TextView textView = view.findViewById(R.id.swipe_textView);    if (CustomAdapterList.titleForOther.equalsIgnoreCase("Vers la lune"))    {        imageView.setImageResource(vers[position]);    }    else {        imageView.setBackgroundResource(image[position]);    }    textView.setText(CustomAdapterList.titleForOther + "");    container.addView(view);    return view;}當我運行我的應用程序并單擊“Vers la lune”標題時,我的應用程序崩潰并出現錯誤:java.lang.OutOfMemoryError: Failed to allocate a 298650252 byte allocation with 12571136 free bytes and 238MB until OOM    at dalvik.system.VMRuntime.newNonMovableArray(Native Method)錯誤來自這一行:imageView.setImageResource(vers[position]);我的清單代碼如下:<application    android:allowBackup="true"    android:hardwareAccelerated="false"    android:icon="@mipmap/ic_launcher"    android:label="@string/app_name"    android:roundIcon="@mipmap/ic_launcher_round"    android:supportsRtl="false"    android:theme="@style/AppTheme"    android:largeHeap="true">
查看完整描述

1 回答

?
陪伴而非守候

TA貢獻1757條經驗 獲得超8個贊

這可能會奏效。添加這個

 android:largeHeap="true"

在您的 Manifest.xml 文件中。在應用程序標簽中。


查看完整回答
反對 回復 2022-07-20
  • 1 回答
  • 0 關注
  • 86 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號