Saving an edittext to bitmap

╄→尐↘猪︶ㄣ 提交于 2019-12-05 16:53:11

To remove the blinking cursor before saving the bitmap you can do

editText.setCursorVisible(false);

And then set it back to true again afterwards.

You just need to remove both underline and cursor when you start capturing the layout. You can remove the underline by:

yourEditText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

and the cursor by:

yourEditText.setCursorVisible(false);

It would be better if you disable the cursor inside your saveToImage method by:

public void saveToImage(RelativeLayout content){
    yourEditText.setCursorVisible(false);
       ....
       ....
    //your code for saving the layout
}

and then after the layout is saved in the memory, just reset the yourEditText to show the cursor.

public void saveToImage(RelativeLayout content){
    //your code for saving the layout
       ....
       ....
    yourEditText.setCursorVisible(true);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!