如何可能的页面卷曲与TextView的android系统? [英] How to possible page curl with textView in android?

查看:164
本文介绍了如何可能的页面卷曲与TextView的android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了很好的harism的项目,允许像下面的链接美丽的分页效果
https://github.com/harism/android_page_curl
但是,只能图像,我的要求是通过写数据使用EDITTEXT,也节约所以,请给我建议或code。
我还参观波纹管给定链路:
<一href=\"http://stackoverflow.com/questions/9195758/android-page-curl-by-harism-adding-textview-caused-and-exception/9883554#9883554\">Android通过harism页面卷曲,TextView的加入引起的异常:
但上面的链接使用的TextView不编辑文本。

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.

推荐答案

它是如此简单。只是下面的方法代替loadBitmap方法在CurlActivity,

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

这篇关于如何可能的页面卷曲与TextView的android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆