Used to the Web page and swing on the text box input, now to Android on the sudden absence of this kind of control, just start to use it is more laborious. In order to realize the input of multi-line text box and display effect, solve the following problems:
1. How to make EditText display as a text box area for input;
2. The cursor is displayed from the first line;
3. How to set the reel;
4. How to fix the size of the text box.
5. How to make the text box display edges;
In order to achieve the following effect, we have done the following work:
<edittext android:id= "@+id/add_content" android:layout_width= "fill_parent" android:layout_ height= "Wrap_content" android:enabled= "true" android:gravity= "top" android:inputtype= " Textmultiline " android:minlines=" 8 " android:maxlines=" android:scrollbars= "vertical " android:background= "@android:d rawable/edit_text" ></EditText>
Above is the XML for this control effect.
Two lines to show the effect of the input area;
Android:inputtype= "Textmultiline" android:minlines= "8"
android:background= "@android:d rawable/edit_text" <! -To display the control's edges,
Android:maxlines= "10"
The maximum number of rows used to set the area above is 10, and more than 10 lines are displayed as "vertical reels".
The android:gravity= "Top" <!-is used to set the starting position of the cursor starting at the top row, otherwise from the middle row by default.