Page scroll when soft keyboard popped up
I fixed the problem by defining the following attribute in <activity> of AndroidManifest.xml android:windowSoftInputMode=”adjustResize”
I fixed the problem by defining the following attribute in <activity> of AndroidManifest.xml android:windowSoftInputMode=”adjustResize”
Several points to begin with: You cannot disable the scrolling of a ScrollView. You would need to extend to ScrollView and override the onTouchEvent method to return false when some condition is matched. The Gallery component scrolls horizontally regardless of whether it is in a ScrollView or not – a ScrollView provides only vertical scrolling … Read more
The answer from Pragna does not work always, try this: mScrollView.post(new Runnable() { public void run() { mScrollView.scrollTo(0, mScrollView.getBottom()); } }); or mScrollView.post(new Runnable() { public void run() { mScrollView.fullScroll(mScrollView.FOCUS_DOWN); } }); if You want to scroll to start mScrollView.post(new Runnable() { public void run() { mScrollView.fullScroll(mScrollView.FOCUS_UP); } });
Try doing: RecyclerView v = (RecyclerView) findViewById(…); v.setNestedScrollingEnabled(false); As an alternative, you can modify your layout using the support design library. I guess your current layout is something like: <ScrollView > <LinearLayout > <View > <!– upper content –> <RecyclerView > <!– with custom layoutmanager –> </LinearLayout > </ScrollView > You can modify that to: … Read more
It seems that it is working, I don’t know what dependency you were working with but in this one compile ‘com.android.support.constraint:constraint-layout:1.0.2’ Is working, this is what I did <?xml version=”1.0″ encoding=”utf-8″?> <ScrollView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” tools:context=”.MainActivity”> <android.support.constraint.ConstraintLayout android:layout_width=”match_parent” android:layout_height=”wrap_content”> <android.support.design.widget.TextInputLayout android:id=”@+id/til_input” android:layout_width=”0dp” android:layout_height=”wrap_content” android:hint=”Escriba el contenido del archivo” app:layout_constraintLeft_toLeftOf=”parent” app:layout_constraintRight_toLeftOf=”@+id/btn_save” app:layout_constraintTop_toTopOf=”@id/btn_save” app:layout_constraintVertical_chainStyle=”spread”> <EditText … Read more
NestedScrollView as the name suggests is used when there is a need for a scrolling view inside another scrolling view. Normally this would be difficult to accomplish since the system would be unable to decide which view to scroll. This is where NestedScrollView comes in.
Update: I figured this out. On my ScrollView, I needed to override the onInterceptTouchEvent method to only intercept the touch event if the Y motion is > the X motion. It seems like the default behavior of a ScrollView is to intercept the touch event whenever there is ANY Y motion. So with the fix, … Read more
you should run the code inside the scroll.post like this: scroll.post(new Runnable() { @Override public void run() { scroll.fullScroll(View.FOCUS_DOWN); } });
For any Child view to scroll inside a ScrollView. Anything like ListView, RecyclerView, etc. You just have to replace ScrollView with androidx.core.widget.NestedScrollView in your current xml and then magic happens. Below is a sample xml code : <?xml version=”1.0″ encoding=”utf-8″?> <androidx.core.widget.NestedScrollView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”match_parent”> <androidx.appcompat.widget.LinearLayoutCompat android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:padding=”16dp” android:paddingBottom=”20dp”> <TextView android:layout_width=”match_parent” android:layout_height=”wrap_content” android:text=”Recycler … Read more
use NestedScrollView instead of ScrollView Please go through NestedScrollView reference document for more information. and add recyclerView.setNestedScrollingEnabled(false); to your RecyclerView