简体   繁体   English

如何在nestedScrollView上滚动到片段的底部?

[英]How can i scroll to the bottom of the fragment on a nestedScrollView?

I have a fragment with a nestedScrollView with some static information and some LinearLayouts with visibility GONE . 我有一个带有nestedScrollViewfragment其中包含一些静态信息和一些具有可见性GONE的 LinearLayouts

Those LinearLayout get fills after this fragment get opened and then I set the visibility of those Layouts on VISIBLE . 在打开该fragment之后,将对那些LinearLayout进行填充,然后在VISIBLE上设置这些Layouts的可见性。 I want just to scroll to the bottom of this fragment when this info load. 我只想在加载此信息时滚动到该片段的底部。

I tried with the property descendantFocusability and using the fullscroll function on this nestedScrollView , but I get no results. 我试图与物业descendantFocusability和使用fullscroll function在这个nestedScrollView,但我没有得到任何结果。

While load the fragment try to call this in onCreateview() in your fragment for scroll at the bottom. 加载片段时,请尝试在片段的onCreateview()中调用它,以在底部滚动。

Runnable runnable=new Runnable() {
        @Override
        public void run() {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    };
    scrollView.post(runnable);

Happy coding!! 编码愉快!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RecyclerView smoothScrollToPosition() 不适用于nestedScrollView。 每当创建片段时,我都想滚动到底部 - RecyclerView smoothScrollToPosition() is not working with nestedScrollView. I want to scroll to the bottom whenever the fragment is created Android espresso NestedScrollView,如何滚动到底部 - Android espresso NestedScrollView, how to scroll to bottom 如何检测底部滚动嵌套滚动视图android的position? - how to detect the position of the scroll nestedscrollview android at the bottom? 将嵌套滚动视图滚动到 textView 的底部 - Scroll nestedscrollview to bottom of textView 如何获取nestedscrollview是否可以滚动? - How to get nestedscrollview can scroll or not? 如何滚动 XML NestedScrollView 内的撰写文本字段? - How can I scroll a compose Textfield inside a XML NestedScrollView? NestedScrollView 内的 Recyclerview - 滚动到底部 - Recyclerview inside NestedScrollView - Scroll to bottom 带有CollapsingToolbarLayout的NestedScrollView如何滚动到EditText? - How can a NestedScrollView with a CollapsingToolbarLayout scroll to an EditText? 如何为nestedscrollview动画到底部 - How to animate nestedscrollview to bottom 当我在swiprefreshlayout和nestedscrollview中使用webview时,如何删除webview底部的空白区域? - How can I remove white space on bottom of webview when i use webview in swiprefreshlayout and nestedscrollview?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM