In the affirmation text field I press the newline button and it puts spaces.
However after I click done the field actually has the correct new lines (second screen capture).
Its not a problem with the device as it works correctly for the compose mail filed in the gmail app. Which is how I would like this to work.
<TextView
android:inputType="textMultiLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="#string/edit_affimation"
/>
<EditText
android:id="#+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false"
>
</EditText>
Figured it out
<EditText
android:inputType="textMultiLine"
android:id="#+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false">
</EditText>
Add following attribute:
android:inputType="textMultiLine"
You can also do it programmatically:
Editext txt = (EditText) findViewById(R.id.affText);
txt.setRawInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
Related
I have a strange problem. Whatever in Edittext , all letters are autocapitalize. I don't want that. I want text to appear same as user types which is lower and uppercase both.
Here is my code
<EditText
android:layout_width="match_parent"
android:textAppearance="? android:attr/textAppearanceSmall"
android:layout_height="150dp"
android:cursorVisible="true"
android:layout_marginBottom="15dp"
android:hint="Feedback"
android:background="#drawable/edit_text"
android:textCursorDrawable="#null"
android:gravity="top"
android:inputType="textMultiLine"
android:padding="8dp"
android:id="#+id/feedback_input" />
Make android:textAllCaps="false" in your edit text.
enter image description hereI am using 2 type edit text in my login page. In Arabic EditText gravity is END.But hint in EditText getting left align Why?. When i give inputType="textPassword" no issues. Issues in android:inputType="textEmailAddress"
EditText code given below
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/userName"
android:inputType="textEmailAddress"
android:gravity="end"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/password"
android:inputType="textPassword"
android:gravity="end" />
Try removing :
android:gravity="end"
In the first EditText. It should automatically make the text RTL if you already placed arabic values-ar in values folder.
Don't forget to add:
android:supportsRtl="true"
In AndroidManifest.xml also.
Update;
Didn’t get you at first but, add these:
android:layoutDirection="rtl"
android:textDirection="rtl"
This will make the layout & text direction rtl and should help for the purpose.
Try with this
<EditText
android:id="#+id/username"
style="#style/Widget.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:hint="#string/username"
android:layoutDirection="locale"
android:padding="10dip"
android:textDirection="locale" />
<EditText
android:id="#+id/password"
style="#style/Widget.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:hint="#string/password"
android:layoutDirection="locale"
android:padding="10dip"
android:textDirection="locale" />
Can someone point me on how to limit the edittext as one line only?
screenshot:
my xml:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:id="#+id/textView_data2"
android:textSize="20sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:maxLines="1"
android:gravity="fill_vertical" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:scrollHorizontally="false"
android:id="#+id/textView_data2"
android:textSize="20sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:maxLines="1"
android:inputType="textPersonName"
android:gravity="fill_vertical" />
Just add into your XML-File android:maxLines="1"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:id="#+id/textView_data2"
android:textSize="20sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:inputType="text"
android:imeOption="actionNext"
android:gravity="fill_vertical" />
android:inputType="text"
android:imeOption="actionNext"
these two lines are the catch. you better use actionDon in imeOption
i.e.,
android:imeOption="actionDone"
use this and you are all good :)
P.S. there are multiple types of imeOption provided by android. We usually use these imeOptions for our softKeyboardInput where we need to change enter button of our keypad to anything else.
e.g., actionDone : DOne button
actionNext :Go to next editBox and etc,
These imeOption only works with inputType="text|number|..i.e. you need to specify a input type for using imeOption.
Hope it will help you :)
i want focus in the second editText ,also can make edit in the first
I have two edit text , i tried to put in the second edittext
android:focusable="true"
android:focusableInTouchMode="true"
but when tested it still focus in the firstEdit text
<EditText
android:id="#+id/editText1Price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/textView2"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<EditText
android:id="#+id/editText2Funds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="#+id/textView4"
android:layout_toLeftOf="#+id/textView4"
android:ems="10"
android:focusable="true"
android:focusableInTouchMode="true"
android:inputType="number"
/>
this may little help you !
try this in your .java file :
EditText edittxt=(EditText)findViewById(R.id.editText2Funds);
edittxt.requestFocus();
Keep <requestFocus/> in the Second EditText.
try this,you have to add below code in which edittext you show focus..
<EditText...>
<requestFocus />
</EditText>
I want to make a input pin code input box as per below image .i have used four edittext for it but my problem is that i m unable to move the cursor from one edittext to other and vice-versa.Please help me on this.
I think something like this will do what you want:
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
Or do you want to auto-jump from one EditText to another when filled?
what do you mean you are unable to "move the cursor from one edittext to other and vice-versa" ??
Like when you type in one character/number in the edit text so the cursor should jump to next edittext?
If so try getFocus() with implementation a TextWatcher for the EditText, it has a callback that gets called after every letter typed in.