Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Renderscript旋转木马示例_Java_Android_Renderscript - Fatal编程技术网

Java Renderscript旋转木马示例

Java Renderscript旋转木马示例,java,android,renderscript,Java,Android,Renderscript,我在Renderscript方面没有太多经验,但我想学习更多。我找到了,但我不确定如何将自己的图像加载到旋转木马中 我对将多个图像加载到旋转木马中感到困惑,因为它不使用适配器,而是使用一个位图,我不确定如何更改此设置 BitmapFactory.decodeResource(res,R.drawable.glossy_overlay); 我做过一些研究,但很难为没有太多经验的人找到可靠的例子。是否有人提供一些资源或示例,说明如何将自己的图像加载到旋转木马中 在CarouseStativity

我在
Renderscript
方面没有太多经验,但我想学习更多。我找到了,但我不确定如何将自己的图像加载到旋转木马中

我对将多个图像加载到旋转木马中感到困惑,因为它不使用
适配器,而是使用一个
位图
,我不确定如何更改此设置

 BitmapFactory.decodeResource(res,R.drawable.glossy_overlay);

我做过一些研究,但很难为没有太多经验的人找到可靠的例子。是否有人提供一些资源或示例,说明如何将自己的图像加载到旋转木马中

在CarouseStativity中定义静态列表

private static final int[] DEFAULT_RESOURCE_LIST =
{ R.drawable.image01, R.drawable.image02, R.drawable.image03,R.drawable.image04, R.drawable.image05,R.drawable.image01, R.drawable.image02, R.drawable.image03,R.drawable.image04, R.drawable.image05}; }
修改值

    private static final int TOTAL_CARDS =DEFAULT_RESOURCE_LIST.length ;
在同一类中修改LocalCarouselViewHelper中的getTexture

@凌驾 公共位图getTexture(int n){

享受

        final Bitmap bitmap = ((BitmapDrawable) getResources()
                .getDrawable(DEFAULT_RESOURCE_LIST[n])).getBitmap();
        return bitmap;
        /*
        Bitmap bitmap = Bitmap.createBitmap(TEXTURE_WIDTH, TEXTURE_HEIGHT,
                Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawARGB(0, 0, 0, 0);
        mPaint.setColor(0x40808080);
        canvas.drawRect(2, 2, TEXTURE_WIDTH-2, TEXTURE_HEIGHT-2, mPaint);
        mPaint.setTextSize(100.0f);
        mPaint.setAntiAlias(true);
        mPaint.setColor(0xffffffff);
        canvas.drawText("" + n, 2, TEXTURE_HEIGHT-10, mPaint);
        canvas.drawBitmap(mGlossyOverlay, null,
                new Rect(PIXEL_BORDER, PIXEL_BORDER,
                        TEXTURE_WIDTH - PIXEL_BORDER, TEXTURE_HEIGHT - PIXEL_BORDER), mPaint);
        return bitmap;
        */
    }