I have a login screen with two EditTexts
and a login button in my layout. The problem is that, when I start typing, the soft keyboard is shown and covers the login button. How can I push the layout up or above the keyboard when it appears?
I do not want to use a ScrollView
, just want to implement it without scrolling down. Please, suggest me some way of doing it. Thanks in advance.
This question is related to
android
android-softkeyboard
Put this in your activity declaration in manifest file
<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>
or if you want you can add in onCreate() method of your activity
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Try this in the android manifest file corresponding to the activity.
<activity android:windowSoftInputMode="adjustPan"> </activity>
Make use of Relative layout it will adjust the view so that you can see that view while typing the text
Set windowSoftInputMode
property to adjustPan
and adjustResize
<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>
This is all that is needed:
<activity android:windowSoftInputMode="adjustResize"> </activity>
Use this code in onCreate()
method:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
You should use
android:windowSoftInputMode="adjustPan|stateHidden"
in your AndroidManifest.xml
file where you are declaring your activity. This will adjust your layout contents, when keyboard is shown in the layout.
If you are working with xamarin, you can put this code
WindowSoftInputMode =Android.Views.SoftInput.AdjustPan | Android.Views.SoftInput.AdjustResize
in activity attribute of the MainActivity class.
For example, now the activity attribute will look like below
[Activity(WindowSoftInputMode =Android.Views.SoftInput.AdjustPan | Android.Views.SoftInput.AdjustResize)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
//some code here.
}
only
android:windowSoftInputMode="adjustResize"
in your activity tag inside Manifest file will do the trick
android:fitsSystemWindows="true"
add property on main layout of layout file and
android:windowSoftInputMode="adjustResize"
add line in your Manifest.xml file on your Activty
its perfect work for me.
This will definitely work for you.
android:windowSoftInputMode="adjustPan"
I solve this by adding code into manifest:
<activity android:name=".Login"
android:fitsSystemWindows="true"
android:windowSoftInputMode="stateHidden|adjustPan"
</activity>
When the softkeyboard appears, it changes the size of main layout, and what you need do is to make a listener for that mainlayout and within that listener, add the code scrollT0(x,y)
to scroll up.
Put this line in activity declaration time in manifest.xml
<android:windowSoftInputMode="adjustPan">
This works like a charm for me
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Accoding to this guide, the correct way to achieve this is by declaring in your manifest:
<activity name="EditContactActivity"
android:windowSoftInputMode="stateVisible|adjustResize">
</activity>
Source: Stackoverflow.com