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.
Related
I am having an issue with EditText as when I entered lines more than it is being shown on the screen then EditText is hidden behind keyboard if I try to edit line which is below the visible area of EditText but If I edit any of those line which is in visible area it adjust the view for keyboard properly. I am not understanding what mistake I am doing?
I have used adjustPan as softInputMode.
Please have a look at this video to better understand what I want to say:
EditTextIssueVideo
EditText Code:
<EditText
android:id="#+id/notes_et"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:ems="10"
android:gravity="top|left"
android:hint="Notes"
android:inputType="textMultiLine"
android:padding="10dp"
android:maxLines="5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/time_tp"
app:layout_constraintVertical_bias="0.202" />
It is probably because you have made your activity full screen. Try not making it full screen.
Check your AndroidManifest if you set
android:windowSoftInputMode="|adjustResize|adjustPan"
in any activity just remove it.
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.
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.
I am defining the EditText as below. I want the Done button to appear in the soft keyboard but I am getting Return button instead.
<EditText
android:id="#+id/txtCommentContent"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_margin="5dp"
android:background="#drawable/bg_edittext_gradient"
android:gravity="top|start"
android:hint="#string/strHintContentComment"
android:maxLines ="4"
android:imeOptions="actionDone"
android:padding="5dp"
android:textSize="15sp"
android:textColor="#color/black"
android:scrollHorizontally="false"/>
Can anyone point out what I am doing wrong?
Did you try?
editText.setImeOptions(editText.getImeOptions()| EditorInfo.IME_ACTION_DONE);
With
android:inputType="text"
You need to add:
android:singleLine="true"
done button will show, but you can not use done button and return button(next line) same time on softkeyboard
Strangely, my soft keyboard is not opening automatically.On SO I have looked they seem to ask on How to hide Keyboard...?
I would like to get the keyboard automatically focues on the Text Box.
Here is what I have on my XML
android:id="#+id/msg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cursorVisible="true"
android:gravity="left"
android:imeOptions="actionDone"
android:inputType="textMultiLine"
android:maxLength="255"
android:paddingLeft="5dp"
android:scrollbars="vertical"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="25sp" />
How to fix this?
You stated "Text box".. If you meant "EditText" than one possibility will be to see if there is any other view that is requesting the focus.
You can also try to add view.requestFocus programatically.
I suppose you need add:
android:textCursorDrawable="#null"
to EditText to see the cursor
Simply add this code <requestFocus /> To the EditText you want to be focused and it will open the keyboard for that field:
<EditText
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" >
<requestFocus />
</EditText>
Add the following line inside your Activity tag in AndroidManifest.xml,
android:windowSoftInputMode="stateAlwaysVisible"
Developer site says,
"stateAlwaysVisible":The soft keyboard is made visible when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity.
reference
https://stackoverflow.com/a/1510005/1665507
http://developer.android.com/guide/topics/manifest/activity-element.html
http://blog.vogella.com/2010/10/25/android-windowsoftinputmode/
why you have to open a keyboard on a code. it will automatically get opened if you are on EditText