2

我正在使用的页面卷曲动画。我想问Harism,我想在所有图像都绘制一次之后如何更改图像。例如。我在第一个实例上绘制了 10 张图像,共 10 页,现在当我从其他一些活动回来时,我想根据(现在)新/修改的数据获得相同的页面以显示修改后的 10 页,目前我得到了我的新/modified 数据附加到前 10 页,因此我得到 20 页的结果,而不是只有 10 页。使用 Curl 动画的任何人都可以帮助我吗?期待中的感谢!!

    private class BitmapProvider implements CurlView.BitmapProvider {

    @Override
    public Bitmap getBitmap(int width, int height, int index) {

        //  LinearLayout linearLayout=(LinearLayout) findViewById(R.id.linearLayout1);


        Bitmap b = Bitmap.createBitmap(width,height,
                Bitmap.Config.ARGB_8888);
        b.eraseColor(Color.BLACK);
        Canvas c = new Canvas(b);

TextView textPageCount= new TextView(AllQuotesActivity.this);
        textPageCount.setText((index+1) +" of " + (allQuotes.size()));
        textPageCount.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM);

        textPageCount.setTextColor(Color.WHITE);
        textPageCount.setTypeface(Typeface.createFromAsset(getAssets(), "Samba.ttf"));
        textPageCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
        textPageCount.setLayoutParams(new LayoutParams(c.getWidth(),c.getHeight()));
        fLayout.addView(textPageCount);



        fLayout.setBackgroundColor(Color.BLACK);
        fLayout.measure(c.getWidth(), c.getHeight());
        fLayout.layout(0, 0, c.getWidth(), c.getHeight());
        fLayout.draw(c);

        return b;
    }


    // I actually call all of these instantiating methods while refreshing the CurlView in hopes that it wouldn't Append the Pages and reDraw it.    
           mCurlView = (CurlView) findViewById(R.id.curl);
    mCurlView.sendClassInstance(this);
    mCurlView.setBitmapProvider(new BitmapProvider());
    mCurlView.setSizeChangedObserver(new SizeChangedObserver());
    mCurlView.setCurrentIndex(index);
    mCurlView.setAllowLastPageCurl(false);
    //  mCurlView.setBackgroundColor(0xFF202830);
    mCurlView.setBackgroundColor(Color.BLACK);
4

1 回答 1

0

您是否尝试将更新后的图像直接设置为 mBitmapIds int[] 中的相应索引。

于 2012-03-28T02:28:21.123 回答