0

I want to know if there is any way I could customize the height of an edit text that I am using. I want it to be something similar to this picture Comment Box

This is my code so far;

<EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textMultiLine"
            android:ems="10"
            android:id="@+id/editText"
            android:layout_gravity="center_horizontal"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:background="#ffe7e7e7"
            android:layout_marginTop="10dp" />

I would like to also know if I could notify the user how much character they have got left to write inside that edit text. So like 100 characters left out of 1000 characters. How can I go about doing this ?

dark_illusion_909099
  • 1,067
  • 2
  • 21
  • 41

1 Answers1

2

you can define lines attribute

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:lines="5"/>

To keep count, you can add TextWatcher to you EditText

Refer: How to use the TextWatcher class in Android?

http://developer.android.com/reference/android/text/TextWatcher.html

Community
  • 1
  • 1
ksarmalkar
  • 1,884
  • 1
  • 16
  • 21