2012-04-03 41 views
3

我發現了一個很好的哈里斯項目,它允許一個漂亮的分頁效果,如下面的鏈接 https://github.com/harism/android_page_curl。 但作品只有圖像,我的要求是使用editText通過寫入數據,也保存所以,請給我建議或代碼。 我也訪問了波紋管給出的鏈接: Android page curl by harism , adding TextView caused and exception : 但上面的鏈接使用textView而不是編輯文本。如何在android中使用textView進行頁面捲曲?

回答

4

它很簡單。只需更換與下面的方法CurlActivity的loadBitmap方法,

private Bitmap loadBitmap(int width, int height, int index) { 
    Bitmap txtBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 
    String text1 = yourPagesStringArray[index]; 
    Canvas c = new Canvas(txtBitmap); 
    TextView tv = new TextView(getApplicationContext()); 
    tv.setText(text1); 
    tv.setTextColor(0xa00050ff); 
    tv.setTextSize(15); 
    tv.setLinksClickable(true); 
    tv.setLineSpacing(2, 2); 
    tv.layout(0, 0, getResources().getDisplayMetrics().widthPixels, getResources().getDisplayMetrics().heightPixels); 
    tv.draw(c); 

    c.drawBitmap(txtBitmap, 0, 0, null); 

    return txtBitmap; 
} 
+0

它的工作原理..但我發現名爲'私人位圖loadBitmap(INT寬度,高度INT,INT指數)'方法名。 – Deepak 2013-03-05 05:50:04

+0

改變修飾符不是一個問題,我猜 – 2013-03-05 06:17:55

+0

和webviews而不是文字?可能嗎? – 2013-04-04 13:15:54