NestedScrollView scroll down itself when content is fills
An alternative to blocking the focus, is to add a new View that will steal the focus. Put it anywhere above the NestedScrollView, and it should work:
<!--focusStealer, to avoid NestedScrollingView to scroll due to dynamically created views that take the focus-->
<View
android:layout_width="0px" android:layout_height="0px" android:focusable="true"
android:focusableInTouchMode="true"/>
Try to set android:descendantFocusability="blocksDescendants"
to the LinearLayout
inside NestedScrollView
. It works for me.
UPD: beware of using into the layout descendant elements like EditText
, which should take a focus: that elements will not take a focus. If you know how to solve this, please let us to know.
This working for me:
mNestedScrollViewChat.post(new Runnable(){
@Override
public void run(){
mNestedScrollViewChat.fullScroll(View.FOCUS_DOWN);
}
});