Android,stackBlur两个问题

阿里·阿卡(Ali Aqa)

我正在使用stackblur,但有一个问题和一个问题:

1.为什么findViewById()总是返回null

2.如何使图像因持续时间而模糊?我的意思是从头开始blur = 0,然后在5秒钟内将其增加到blur = 20

穆罕默德·里法特

1 -我认为你正在使用findViewById()检索View不在当前布局(不能确切地告诉你,所以我不能图如何实现stackblur没有显示你的代码),所以,尽量inflatelayout包含View,然后通过实例获取元素:

LayoutInflater inflater = (LayoutInflater) CurrentActivity.this
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.layout_contains_the_view,
                        (ViewGroup) findViewById(R.id.main_view_in_that_layout));
// So, for example if you want to get a TextView
TextView text = (TextView) layout.findViewById(R.id.text_view_name);

2-用于使图像模糊0逐渐增加到20

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            int blur = 0;
            set_image_blur(blur);
            for(int i =0; i < 5000; i++){
                blur = blur + (20*(i/5000));
                set_image_blur(blur);
            }
        }
    });

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章