EditText gaining focus but my typing doesn't append - android

I have an EditText and have a hint. When I tap on the EditText, the keyboard appears, though, as I type neither the hint goes away nor my typing goes into view. It's like my input is going to /dev/null. My EditText is inside a ListView cell, if it helps. Here is my layout:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="#00000000"
android:id="#+id/aboutView"
android:layout_gravity="center_horizontal|bottom"
android:layout_centerHorizontal="true"
android:layout_below="#+id/headerFrame"
android:layout_marginTop="12dp"
android:gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textSize="14dp"
android:layout_marginBottom="12dp"
android:hint="Tell something about yourself..." />
Why can this be?

Found the solution here: EditText in Listview loses focus when pressed on Android 4.x
I don't know the exact reason, but I wasn't the only one suffering from EditText focus problems when inside a ListView. I've added android:windowSoftInputMode="adjustPan" to my activity in manifest file and the problem went away.

Related

Done key not showing up on keyboard

I am making an Android app and want the done key to show up on the keyboard when the user is typing into the keyboard.
This is the XML code for the EditText:
<EditText
android:id="#+id/answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:layout_marginBottom="113dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:imeOptions="actionDone"
/>
I thought that adding the android:imeOptions="actionsDone would have the done button appear, but instead the enter button is there and when it is pressed, a new line is created in the EditText. What is the issue?
You will not get done by adding imeOptions.
Add the below attribute to your EditText:
android:singleLine="true"
This will make your EditText a single line and you will see the Done button if that is the only EditText or last EditText. If there are multiple EditText items, then you will see Next button.

Keyboard doesn't show when clicking into a MultiAutoCompleteTextView

I am having the problem that the soft keyboard doesn't come up when clicking into the MultiAutoCompleteTextView. When I first click into another EditText and then change to the MultiAutoCompleteTextView, I can enter text but not when I click into it directly.
I don't use anything like requestFocus or onClick handlers.
Here is the XML:
<MultiAutoCompleteTextView
android:id="#+id/thingTags"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="0dp"
android:hint="#string/hint_tags"
android:inputType="textShortMessage"
android:textIsSelectable="true" />
Turns out the android:textIsSelectable="true" is the culprit. If I remove that, it works again.

How to roll up EditText?

I have an EditText defined in my half screen RelativeLayout. and it appears perfectly. However, if I start typing typing more than 1 line in my EditText, it makes my entire entire window expand. I want the EditText to roll up and only show the currently typing line? Like in Facebook Messager, I want the EditText to keep scrolling itself as the user types new lines? HEre is how I implemented the EditText
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/button1"
android:ems="10"
android:focusable="true"
android:inputType="textMultiLine" />
Just set
android:maxLines="1"
This makes the TextView be at most this many lines tall.

Android keyboard is changing from numeric to alphabet

I did the following code in my program:
<RelativeLayout
....>
<EditText
android:id="#+id/EditText"
android:layout_width="150dp"
android:layout_height="37dp"
android:layout_below="#+id/Header"
android:layout_toRightOf="#+id/Button"
android:inputType="number"
android:textSize="14dp" />
</RelativeLayout>
but whenever I tried it on my app, the app will first pop out the numeric keypad, and then a sec later, it will changed to alphabet keypad and the edittext is no longer on focus.
Can anyone help? Thanks!
It sounds like somewhere in your layout or UI code something else is using requestFocus, perhaps another input field that is not of type number.

Strange error of dimensionally on the EditText after disabling the standard Android keyboard

in my app I have disabled the standard Android keyboard for each EditText with
myEditText.setInputType(0);
but now when I use the instruction:
myEditText.setText("string");
the sizes of my EditText does not fit to the size of the text you entered; so the text is not displaying in whole.
How can I fix this?
This is my xml:
<LinearLayout
android:layout_width="305dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="DECIMAL:"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25sp"
android:textStyle="bold" android:textColor="#000000"/>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
>
</LinearLayout>
If you want to disable editText then I recommend to use editText.setEnabled(false). Hiding keyboard is not the right solution until you really need it. But if you have disabled edittext then keyboard will not appear even if you focus on it.
I don't think problem is because of keyboard. One thing I observed in your code is, you are setting ems for editText. I think because of ems, editText size is constant always. Check this link for more information.

Categories

Resources