How to possible page curl with textView in android?

梦想的初衷 提交于 2019-12-06 08:22:52

问题


I found the good harism's project that allows a beautiful paging effect like following link https://github.com/harism/android_page_curl. But works only images,My requirement is to use editText through write data and also save So,kindly give me Suggestion or code. I also visit bellow given link: Android page curl by harism , adding TextView caused and exception : But above link use textView not Edit Text.


回答1:


it is so simple. Just replace the loadBitmap method in the CurlActivity with the 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;
}


来源:https://stackoverflow.com/questions/9990855/how-to-possible-page-curl-with-textview-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!