Android : Maximum allowed width & height of bitmap

前端 未结 5 1952
广开言路
广开言路 2020-11-27 04:37

Im creating an app that needs to decode large images to bitmaps to be displayed in a ImageView.

If i just try to decode them straight to a bitmap i get the following

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 05:17

    If you're on API level 14+ (ICS) you can use the getMaximumBitmapWidth and getMaximumBitmapHeight functions on the Canvas class. This would work on both hardware accelerated and software layers.

    I believe the Android hardware must at least support 2048x2048, so that would be a safe lowest value. On software layers, the max size is 32766x32766.

提交回复
热议问题