Android从不调用onCreateThumbnail方法 [英] Android never call method onCreateThumbnail

查看:196
本文介绍了Android从不调用onCreateThumbnail方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于Android文档,方法 onCreateThumbnail ,并且应在该位图的尺寸内将所需缩略图的图像绘制到outBitmap中.如果需要,它可以使用给定的canvas(用于配置绘制到位图中)进行渲染.

Based on Android documentation, method onCreateThumbnail is called before pausing the activity, and should draw into outBitmap the imagery for the desired thumbnail in the dimensions of that bitmap. It can use the given canvas, which is configured to draw into the bitmap, for rendering if desired.

默认实现返回失败,并且不绘制缩略图;这将导致平台根据需要创建自己的缩略图.

The default implementation returns fails and does not draw a thumbnail; this will result in the platform creating its own thumbnail if needed.

当该方法返回true时,系统将不使用标准缩略图,而是使用(或应使用)绘制到canvas中的自定义缩略图.

When the method returns true, system will not use a standard thumbnail, but custom thumbnail drawn into the canvas is (or should be) used.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Window window = getWindow();
    // cleared by default, but let's make it explicit
    window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE); 
}

// @Override
public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas) {
    Log.d(TAG, "onCreateThumbnail");
    return false;
}

但是,看来系统从不调用此方法.是否需要一些特殊的设置或标志来调用此方法并能够为活动生成自己的缩略图?

However, it seems that the system never call this method. Is there some special settings or flag needed to have this method called and being able to generate own thumbnail for the activity?

推荐答案

无法自定义系统在最新应用预览中使用的活动缩略图.

方法onCreateThumbnail自从Android 4.0.3被取消注释时,其调用已被断开(请参见

The method onCreateThumbnail had been broken since Android 4.0.3, when its call was commented out (see the source code).

这篇关于Android从不调用onCreateThumbnail方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆