How can pages be curled using textView in Android?

I found a nice charisma project that allows for a nice paging effect like the following link https://github.com/harism/android_page_curl . But only images work. My requirement is to use editText via writing data as well as saving. So, kindly give me a suggestion or code. I will also visit the following link: screenshot of android page from harism, add and exclude TextView: But above the link, use textView not Edit Text.

+3


source to share


1 answer


it is so simple. Just replace loadBitmap method in CurlActivity with below method,



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;
}

      

+4


source







All Articles