簡體   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