2

私が使用しているページカールアニメーション。一度描いた絵をどう変えたらいいのか、ハリスマさんに聞いてみました。たとえば。最初のインスタンスで 10 ページの 10 枚の画像を描画しましたが、他のアクティビティから戻ってきたときに、同じページを取得して、(現在) 新しい/変更されたデータに従って変更された 10 ページを表示したいと考えています。現在、新しいものを取得しています。 /modified データが最初の 10 ページに追加されたため、結果は 10 ページではなく 20 ページになりました。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 に答える