我的问题是我想从编辑文本中获取确切的文本,其字体设置在编辑文本中,以及文本大小、文本颜色和文本样式,如粗体、斜体和下划线。
直到现在我像这样使用 Spannable Spannable messageText;
并像这样从 EditText 获取文本
messageText = editText.getText();
并设置为 textview
textView.setText(messageText);
但在这种情况下,它只返回简单的字符串 not color,font,size and style
。
EditText
<EditText
android:id="@+id/message"
android:layout_width="fill_parent"
android:layout_height="180dp"
android:inputType="textMultiLine"
android:singleLine="false"
android:tag="no"
android:textColor="#000000"
android:textSize="15sp"
android:textStyle="normal"
android:typeface="normal" />
TextView
<TextView
android:id="@+id/preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000000"
android:textSize="15sp"
android:textStyle="normal"
android:typeface="normal" />
帮帮我,谢谢