我找到了一个很好的 harism 项目,它允许像下面的链接一样漂亮的分页效果 https://github.com/harism/android_page_curl . 但只适用于图像,我的要求是通过写入数据使用 editText 并保存 所以,请给我建议或代码。 我还访问了下面给出的链接: Android page curl by harism , adding TextView caused and exception : 但是上面的链接使用 textView 而不是 Edit Text。
最佳答案
就是这么简单。只需将 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;
}
关于android - 如何在 android 中使用 textView 进行页面 curl ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9990855/