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”
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.
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); } });
In manifest add this line on the particular activity tag: android:windowSoftInputMode=”adjustPan”
Made a few tweaks in your code and it is working fine now. 1] onMeasure function wasn’t proper. Use below logic @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mCurrentView == null) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; } int height = 0; mCurrentView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int h = mCurrentView.getMeasuredHeight(); if (h > height) height = … Read more
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
Please try this If you are using ListView – override the following methods. @Override public int getViewTypeCount() { return getCount(); } @Override public int getItemViewType(int position) { return position; } If you are using RecyclerView – override only getItemViewType() method. @Override public int getItemViewType(int position) { return position; }
Wrap all the children inside of another LinearLayout with wrap_content for both the width and the height as well as the vertical orientation.
you should run the code inside the scroll.post like this: scroll.post(new Runnable() { @Override public void run() { scroll.fullScroll(View.FOCUS_DOWN); } });
I was able to find a simple way to achieve both scrolling behaviors. Here is the xml for it: <ScrollView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:scrollbars=”vertical”> <HorizontalScrollView android:layout_width=”320px” android:layout_height=”fill_parent”> <TableLayout android:id=”@+id/linlay” android:layout_width=”320px” android:layout_height=”fill_parent” android:stretchColumns=”1″ android:background=”#000000″/> </HorizontalScrollView> </ScrollView>