Several problems of Android EditText multi-line text input

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.