Adjust pan not Working When Edit text Height Mentioned in Android - android

i am usign adjustpan in activity it's scroll perfect when simple Edit text with single line but, it's not work properly in multiline edittext with height mentioned like below ediitext xml layout
<EditText
android:id="#+id/txt_feedback"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txt_to"
android:layout_alignRight="#+id/txt_to"
android:ems="10"
android:gravity="top|left"
android:inputType="textMultiLine"
android:lines="8"
android:maxLength="160"
android:minLines="6"
android:scrollbars="vertical"
android:background="#drawable/textboxborder"
android:padding="2dp"
android:singleLine="false"
android:layout_marginTop="5dp"
android:visibility="gone"
android:hint="-- Your Comments --"
android:layout_marginLeft="40dp" />
for current output below like screen:
and i am excepted output like below screen:
and how to do this somebody help me ?
Thanks :)

Related

Vertical center each line in multi line edittext

I have a multiline edittext with maxLines as 1. When the input exceeds more than one line, the previous lines entered shift by few pixels to top as shown in image 1 below.
How can i center vertical each line in edittext?
<EditText android:id="#+id/et"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="50dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:maxLines="1"
android:inputType="textMultiLine|textNoSuggestions"/>
I figured it out:
You've set android:layout_height="30dp" and depending on the user phone's font size or your own app's it will show just part of it or have extra room like you had in your first picture:
change the EditText to:
<EditText
android:id="#+id/et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:maxLines="1"
android:inputType="textMultiLine|textNoSuggestions"
/>
I've tested it and worked fine, but let me know if it's not working for you.

How can we specify line limit in multiline EditText with done action on keyboard in android?

I have Multiline EditText in my project. I want limit of line in my EditText. I specify all the property's like android:lines="3", android:maxLines="2", android:gravity="top|left" etc. in it but it is not restricted to 3 line. It is going beyond that.
My EditText code is :
<EditText
android:id="#+id/etForDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_back_profile"
android:hint="#string/desc"
android:imeOptions="actionDone"
android:paddingBottom="10dp"
android:paddingLeft="13dp"
android:lines="3"
android:maxLines="2"
android:gravity="top|left"
android:paddingTop="10dp"
android:textStyle="normal" />
Please help me.
Thank you.

Android EditText not expanding when hitting enter

I have a EditText look like this in my layout xml and it's not expanding when the user hit enter
<EditText
android:layout_height="40dp"
android:layout_width="fill_parent"
android:gravity="top"
android:maxLines="10"
android:minHeight="40dp"
android:id="#+id/edSearch"
android:layout_toLeftOf="#+id/btnSearch"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:hint="City..."
/>
but when i changed android:layout_height="40dp" to android:layout_height="wrap_content" the the edittext is able to expand as the user hit enter.
how I can keep my EditText expanding while keeping this line android:layout_height="40dp"
Thanks
Try this
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="Top"
android:maxLines="10"
android:minHeight="40dp"
android:id="#+id/edSearch"
android:layout_toLeftOf="#+id/btnSearch"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:inputType="textMultiLine"
android:hint="City..."
/>
Hope this will work
I'm using following code and it's working great. to set minimum height instead of setting layout_height to 40dp set it wrap_content and set attribute of minLines to achieve this as show below in code example
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:minLines="4"
android:maxLines="10"
/>
Set property android:multiline="true".
hope this will help you.
Set android:multiline="true" along with android:gravity="left|top"

how to fix the size of multiline edit text

I want to make a multi line edit text but the problem is that whenever i enter new line height of edit text increases. how to fix its height. My code is
<EditText
android:id="#+id/editAdditionalInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editPhoneCutomerDetails"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp"
android:layout_below="#+id/editPhoneCutomerDetails"
android:layout_marginTop="10dp"
android:background="#drawable/message_additional_box1x"
android:ems="10"
android:padding="10dp"
android:gravity="top">
<requestFocus />
</EditText>
To fix the size of editText you can use
android:singleLine="true"
but it can limit your editText line to 1 .
if you want more lines in editText then use the following property.
Use android:lines="3" .
Use android:lines="2" for fixing multilines and for fixing single line use android:singleLine="true"
for example use like this as shown for multilines
<EditText
android:id="#+id/.."
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Name"
android:maxLength="20"
android:lines="2"// fix the multiline limit
android:textColor="#000000" />
for example use like this as shown for single line
<EditText
android:id="#+id/.."
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Name"
android:maxLength="20"
android:singleLine="true"// fix the single line limit
android:textColor="#000000" />
try this;
android:inputType="textMultiLine"
<EditText
android:inputType="textMultiLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
As singleline is now deprecated use inputType:multiline and set the number of lines you want with lines tag
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="4"/>
I had a similar requirement but ended up not changing the size of the box. i.e it grows as text is typed into it but stops short of blocking the other widgets in view. I read this post during my quest and had found a solution. Decided to post it back here. Restricting size to a value may possibly have different effects on different screens. So I think it is better to let it be.
The thing is to put the edit text inside a linearlayout with the rest of the widgets. The code and snapshot are here
Multi line edit box with ok cancel buttons

Edit text in android

Hi am having one Edit Text which is used to get the information about the user.i have set the following properties to edit text
<EditText
android:id="#+id/profile_about"
android:layout_below="#id/AboutYou"
android:layout_centerInParent="true"
android:layout_marginLeft="8dip"
android:layout_marginBottom="10dip"
android:layout_marginRight="18dip"
android:gravity="top|left"
android:inputType="textCapWords"
android:textColor="#000000"
android:background="#drawable/edittext"
android:layout_width="300dip"
android:layout_height="100dip"
android:textSize="16sp"
/>
the problem is it scrolls horizontal only.not go the newline after entering certain characters.can anybody help me?
I replaced android:inputType="textCapWords" by android:inputType="textMultiLine|textCapWords", and it works.
Try using android:singleLine="false"
android:singleLine="false"
if this property is set then the charecters after a certain limit will go to next line automatically...
try this too
android:scrollHorizontally="false"

Categories

Resources