2012-02-19 17 views
2

。 我想問Harism,我想如何改變圖像後,他們都繪製一次。 例如。我有10個圖像在第一個實例上繪製10頁,現在當我從其他一些活動回來時,我想根據(新)/修改後的數據顯示修改過的10個頁面,目前我得到我的新/修改後的數據附加到前10頁,因此我得到的結果是20頁,而不是隻有10頁。 任何使用捲曲動畫的人都可以幫助我嗎? 感謝預期!由哈利斯捲曲動畫不geting更新爲同一組圖像在畫布上,而是附加到已經設置的圖像我正在使用的頁面捲曲動畫

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); 
+0

小心分享代碼,讓我們所有人都可以享受它nd也許嘗試回答?這不是私人論壇。 – codeScriber 2012-02-19 21:45:05

+0

對不起,實際上我需要刷新Curl活動視圖的這種方法,但似乎每當我嘗試修改和添加新頁面時,PageCount文本視圖始終保持加倍而不是簡單修改,您是否可以拋開一些光線它? – 2012-02-19 23:10:41

+0

你從哪裏得到這個圖書館? github? sourceforge?付費? – codeScriber 2012-02-20 07:00:35

回答

0

您是否嘗試將更新的圖像直接設置爲mBitmapIds int []中的相應索引。