2014-06-05 22 views
0

我在畫布上做了一些繪畫。 我有一個多行edittext。 如何在畫布上顯示多行文字?如何檢索EditText多行文本,因爲它是Android?

<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. 

如果輸入是多行的,如何將它作爲多行存儲在字符串中?

非常感謝!

+0

您可以發佈任何例子..? –

+0

您是否在Draw方法上以編程方式添加edittext –

+0

我已經添加了我的示例 – user3678711

回答

0

使用RichEditText而不是EditText可能會解決您的問題。

看這個Project on 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>