繁体   English   中英

如何检索EditText多行文本,因为它是android?

[英]How to retrieve EditText multiline text as it is android?

我在画布上画画。 我有多行edittext。 如何在画布上将文本显示为多行?

 <EditText
        android:id="@+id/input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
       />



 final TextView textview = (TextView) view.findViewById(R.id.input);
....
  @Override
            public void onClick(View v) {

                text = textview.getText().toString();
...//Here I store the input from edittext in the string.

如果输入是多行,如何将其存储为字符串中的多行?

在此先感谢!!!

使用RichEditText而不是EditText可能会解决您的问题。

在GitHub上查看此项目

您可能需要在xml文件中使用它,而不是普通的EditText

<com.commonsware.cwac.richedit.RichEditText xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/editor"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:gravity="top|left"
  android:inputType="textMultiLine">

  <requestFocus/>

</com.commonsware.cwac.richedit.RichEditText>

暂无
暂无

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

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