Why the android keyboard cover my EditText? [duplicate] - android

This question already has answers here:
Android soft keyboard covers EditText field
(15 answers)
Closed 7 years ago.
I define EditText on the button of my application
Its look like this:
But when i focus on the EditText of the Notes the keyboard is open and cover all my EditText and i can't see what i typing in the EditText.
When i hide the keyboard i see the right text that i typed in.
The xml of the LinearLayout of the EditText:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Notes:"
android:id="#+id/textView"
android:textColor="#000000" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:focusable="true" />
</LinearLayout>

You might need to use windowSoftInputMode attribute in your activity in the manifest. Somelike this:
<activity name="YourActivity"
android:windowSoftInputMode="adjustPan">
...
</activity>
Check those links:
Android soft keyboard covers edittext field
http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

The only solution to this is to put your text box in a different place.
Think about it... Do you really want your text box ABOVE your keyboard?
This is a fairly common issue, and it something that should always be taken into account when designing your layout.

so this solve my problem ( thanks to #Coeus )
I define on the manifest this line
android:windowSoftInputMode="adjustPan"

Related

Stop Decimal EditText from gaining focus on startup

I have followed this solution on preventing edit text from taking focus on activity startup. And implemented it as such
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/amount"
android:text="#string/zero"
android:gravity="end|center_vertical"
android:nextFocusUp="#id/amount"
android:nextFocusLeft="#id/amount"
android:inputType="numberDecimal"/>
Notice the android:inputType="numberDecimal". If I remove that then upon startup the focus is not taken, however if it is there then focus is taken. Is there any way to get decimal edit text to not take focus upon startup? I am using API > 23 if it is of any concern.
And just as a side note from looking at answers other people provided to similar questions, I want my field to not take focus. I do not want to only hide the soft keyboard but keep the focus.
Add this to your activity tag in manifest
android:windowSoftInputMode="stateHidden|adjustResize"
Code looks like in manifest
<activity
android:name=".ActivityName"
android:windowSoftInputMode="stateHidden|adjustResize" />
This will help hide soft keyboard at startup
And add these tags to your root layout rather than parent layout
android:focusable="true"
android:focusableInTouchMode="true"

TextInputLayout auto focus [duplicate]

This question already has answers here:
android prevent EditText from requesting focus automatically [duplicate]
(3 answers)
Closed 7 years ago.
I have a layout with a single TextInputLayout with an EditText inside it.
When the layout is loaded the EditText is immediately in edit mode, the keyboard is not up but the cursor is blinking and the hint is not inside the EditText but above it.
I want the hint to be animated out of the EditText only the the use first clicks the EditText.
How can I accomplish that? I have tried clearFocus() on both the EditText and the TextInputLayout.
My xml:
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<EditText
android:singleLine="true"
android:id="#+id/case_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Case name" >
</EditText>
</android.support.design.widget.TextInputLayout>
try this
editText.setCursorVisible(false)

How to make Android EditText expand vertically when full

I have this EditText
<EditText
android:layout_width="match_parent"
android:layout_height="72dp"
android:hint="#string/write_message"
android:textColorHint="#color/primary_color"
android:ems="10"
android:imeOptions="actionDone"
android:inputType="textImeMultiLine"
android:id="#+id/message_input"
android:layout_gravity="center_horizontal"
android:backgroundTint="#color/primary_color"/>
When the box is filled up with user inputted text, it scrolls to the right to make room for more text, I do not like this behavior, and would prefer it if the EditText box expanded upwards when it needs more room? Is there a way to do this? Thanks.
Yes, this actually involves two things:
Making the EditText accept multi-line input.
Having its height grow as more text lines are added.
Therefore, to achieve this, you need to set up:
android:inputType="textMultiLine"
android:layout_height="wrap_content"
(Be mindful of the difference between textMultiLine and textImeMultiLine).
The full XML snippet would be:
<EditText
android:layout_width="match_parent"
android:inputType="textMultiLine"
android:layout_height="wrap_content"
android:hint="#string/write_message"
android:textColorHint="#color/primary_color"
android:ems="10"
android:imeOptions="actionDone"
android:id="#+id/message_input"
android:layout_gravity="center_horizontal"
android:backgroundTint="#color/primary_color"/>
Use both flags: textMultiLine will wrap your input, and textImeMultiLine will provide a break-line key in your keyboard.
<EditText
...
android:layout_height="wrap_content"
android:inputType="textImeMultiLine|textMultiLine"
... />
In my case I have multiline text, but it showed one line and a keyboard:
Though I have already set android:inputType="textCapSentences|textAutoCorrect|textMultiLine", it didn't help. Then I understood that when the keyboard appears in DialogFragment, it collapses the EditText. See DialogFragment and force to show keyboard to show keyboard when DialogFragment shows.
Then I added a short delay (100-300 ms) before showing the keyboard. Now I have:
In AndroidManifest I set android:windowSoftInputMode="adjustResize" for current activity.

Click on EditText won't show the keyboard?

I have a table whose tapping on a cell changes its content and displays some edit texts. The first of these edit texts requests the focus, but oddly when I tap on it, the keyboard doesn't show. It is when I tap the others edit texts though. What should I do? Here is how I implemented my first edit text.
<EditText
android:id="#+id/editContent"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:gravity="top"
android:inputType="textMultiLine" >
</requestFocus>
</EditText>
When I don't request the focus, there is also a strange behaviour: it opens the keyboard when I tap it but my edit text loses the focus and I've to tap it again to write in it.
I found the problem, it was because of this line in the Activity block of the Manifest :
android:windowSoftInputMode="stateHidden"
I changed it by :
android:windowSoftInputMode="adjustPan"
Works well now.

Input text behaves stranges with edittext android

for some reason android doesn't put the text input above the 'keyboard'. Because of this you can't see what your typing. I have tried various things but without result does anyway have clue?
this is the code:
<EditText
android:id="#+id/comment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
You should add to your application Manifest this property to each activity where this problem occurs:
android:windowSoftInputMode="adjustResize"

Categories

Resources