Android - 使 gif 适合屏幕尺寸
Android - Fit gif to screen sizes
我正在使用 android-gif-drawable 库在我的 android 应用程序中显示 gif 图像。如您所知,gif 图像应该在 assets
文件夹中而不是在 drawable
中,因此 android 无法在不同尺寸之间自动切换。
如何针对不同的屏幕尺寸处理此问题?
参考this Find Device density of device and set gif-image accordingly. More idea about DisplayMetrics
只有一种方式:
尝试手动更改 gif。使用getResources().getDisplayMetrics().density;
查找设备密度,然后根据此更改gif。
我正在使用 android-gif-drawable 库在我的 android 应用程序中显示 gif 图像。如您所知,gif 图像应该在 assets
文件夹中而不是在 drawable
中,因此 android 无法在不同尺寸之间自动切换。
如何针对不同的屏幕尺寸处理此问题?
参考this Find Device density of device and set gif-image accordingly. More idea about DisplayMetrics
只有一种方式:
尝试手动更改 gif。使用getResources().getDisplayMetrics().density;
查找设备密度,然后根据此更改gif。