简体   繁体   English

如何在 android studio 的 EditText Bold 或 Italic 中制作任何选定的文本并将其存储到 SQLite 数据库中?

[英]How can I make any selected text in an EditText Bold or Italic in android studio and store it into a SQLite database?

如何在 android studio 的 EditText BoldItalic中制作任何选定的文本并将其存储到 SQLite 数据库中?

First make a class to get the start and end position of the selected text.首先创建一个类来获取所选文本的开始和结束位置。 And a style variable for storing bold, italic or underline以及用于存储粗体、斜体或下划线的样式变量

class typefaces{

int style,start,end; int 风格,开始,结束; } }

Then store the variable of the edittext in the database然后将edittext的变量存入数据库

start = edittext.selectionstart();
end = edittext.selectionend();
dbhelper.insertTypes(style,start,end);

add the values to the database and retrieve to again show the saved.将值添加到数据库并检索以再次显示保存的值。 Use spans to add bold, italics and underline types使用跨度添加粗体、斜体和下划线类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM