Skip to content Skip to sidebar Skip to footer

Scroll View Is Not Working When Keyboard Is Open

I am using ScrollView for scrolling my layout.But not working in Fragment class when keyboard is open. I am novice with Fragments. Here is my XML Code:

Solution 1:

I am sugesting you to use LinearLayout instead of relative layout with vertical orientation layout in which you are using scroll and to hide your keyboard you can use the below code when you scroll the view just use

ScrollView anyname;
anyname =(ScrollView)rootView.findViewById(R.id.sv_rl_user_settings);
anyname.setparentView.setOnTouchListener(this);



@OverridepublicbooleanonTouch(View v, MotionEvent event) {
            InputMethodManagerimm= (InputMethodManager) getactivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(getactivity().getWindow().getCurrentFocus().getWindowToken(), 0);
            returnfalse;

        }
in your fragment java file i hope it will work

Solution 2:

use this in ur manifest

android:windowSoftInputMode="adjustPan|stateAlwaysVisible"

Solution 3:

Remove Gravity from First child of ScrollView. And Add Following lines in your scrollView

android:scrollbars="vertical"android:fillViewport="true"

Solution 4:

Solution 5:

Use this in your manifest android:windowSoftInputMode="adjustResize|stateAlwaysVisible"

Post a Comment for "Scroll View Is Not Working When Keyboard Is Open"