Issue
Making a simple calorie converter.
Here's the problem in pictures.
I'm on a Genymotion emulator.
Here is the part of the screen I'm having issues with:
When I click on an EditText number field, the numberpad comes up
But there's a next arrow I must click which takes me to the next input field
Before I can finally just get out of the numberpad.
What's going on? After I type in a number into one edit text I want it to end right there, not jump to the next Edit Text. Also, it's weird because if I enter a number in the two bottom EditTexts they end right away whereas if I enter a number in the top EditTexts they take me to one of the bottom EditTexts.
Here's the XML file.
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText2"
android:layout_below="@+id/imageView2"
android:layout_alignEnd="@+id/imageView2"
android:layout_alignStart="@+id/imageView2" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText3"
android:layout_alignBottom="@+id/editText2"
android:layout_alignEnd="@+id/imageView4"
android:layout_alignStart="@+id/imageView4" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText4"
android:layout_marginBottom="32dp"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/imageView5"
android:layout_alignEnd="@+id/imageView5" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText5"
android:layout_alignTop="@+id/editText4"
android:layout_alignStart="@+id/imageView3"
android:layout_toStartOf="@+id/editText2" />
Thank you!!!
Solution
If you want to jump next field you mentioned the id in editText itself using nextFocusDown attribute.
try this....
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText2"
android:layout_below="@+id/imageView2"
android:layout_alignEnd="@+id/imageView2"
android:layout_alignStart="@+id/imageView2"
android:nextFocusDown="@+id/editText3"/>
when you want to show done on SoftKeyboard at particular view use android:imeOptions="actionDone" attribute.
Answered By - Vishwa
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.