nestedscrollview

Scroll behaviour of AndroidX RecyclerView view with NestedScrollView

为君一笑 提交于 2019-12-12 18:22:29
问题 I'm migrating my application from appcompat to AndroidX. Everything works except that I am not able to set one scroll for both androidx.core.widget.NestedScrollView and androidx.recyclerview.widget.RecyclerView . I have tried adding setHasFixedSize(true) setNestedScrollingEnabled(false) but it's not working. My XML now looks this way: <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView android:clipToPadding="false" android:id="@+id/scroll" android:layout_height="wrap

Hide a Floating Action Button of another Layout

扶醉桌前 提交于 2019-12-12 08:38:32
问题 I have a FloatingActionButton inside of may activity_main.xml layout which is named fabBtn . My application is built with a ViewPager and three Fragment s.I want to hide the FloatingActionButton when my first Fragment detects a scroll, but I keep getting a NullPointerException if the user starts scrolling. I believe it could be that my fragment can't get the FloatingActionButton from the activity_main.xml layout? Here is my activity_main.xml <android.support.design.widget.CoordinatorLayout

Set Custom List view inside NestedScrollView

别来无恙 提交于 2019-12-12 00:33:07
问题 I am moving to Coordinator Layout and Nested ScrollView and i know to make it work i need to use recycle r view but the thing is i really want to make it possible with old List View is there any way i can achieve that Here is what i am doing <?xml version="1.0" encoding="utf-8"?> <!-- NOT SET HERE: android:fitsSystemWindows="true" --> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android

Espresso testing NestedScrollView - “Error performing 'scroll to' on view 'with id:”

烈酒焚心 提交于 2019-12-10 12:58:32
问题 I need to scroll down through my NestedScrollView in order to test my xml file with Espresso, but I get the error message: "Error performing 'scroll to' on view 'with id:" Several other posts that seem to have a similar problem. I have followed instructions from this: Android espresso NestedScrollView, how to scroll to bottom Now I get the forementioned error, and found this post: Scrolling to view was attempted, but the view is not displayed I have no padding in my NestedScrollView - I even

RecyclerView calling onCreateViewHolder and onBindViewHolder for all items at once

旧街凉风 提交于 2019-12-10 03:28:43
问题 I have a recyclerView capable of showing the maximum of 3 items on screen, but it calls onCreateViewHolder and onBindViewHolder for all 45 items in the list, all at once (as in the LOG below). Shouldn't it be calling those methods only as I scroll those items to the screen? *I am using a list with 0's and 1's as a test to define which layout it should use. My Adapter Code public class MyRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { int[] post_list; private static

How to show the Scrollbar in a NestedScrollView

做~自己de王妃 提交于 2019-12-09 11:05:56
问题 Hey i implemented a NestedScrollView in an Activity, but i cant show the scrollbar like i do in a ScrollView, can you guys. How can I show it? <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/appBar"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="false" android:clipToPadding="false" android:orientation="vertical" android:paddingLeft="

Recyclerview scrollToPosition doesn't work with NestedScrollView ? Is there anyway?

亡梦爱人 提交于 2019-12-07 09:23:00
问题 So I have a Recyclerview within a NestedScrollView . When I say recycleview.scrollToPosition(X) or recycleview.getLayoutManager().scrollToPosition(X) it doesn't work at all. If I move the recycleview out from the nestedScrollView it works fine, but I can't do it, because of the layout structure! Any idea? scrollingView.requestChildFocus(recyclerView,recyclerView); tried this, but not focusing on a certain position 回答1: make your recyclerview like this <LinearLayout android:id="@+id/ll2"

BottomSheet效果的两种实现方式

霸气de小男生 提交于 2019-12-06 19:43:05
BottomSheet效果的两种实现方式 单页面添加BottomSheet效果 BottomSheetDialog实现通用效果 BottomSheet的效果是指从屏幕底部向上滑的效果,是MaterialDesign风格的一种,视觉效果如下: 实现这种效果有几种不同的方式,如果是在一个固定的页面上添加这种效果,可以在该页面布局中添加BoottomSheet相关的控件。如果是作为通用控件来提供给不同页面使用,则可以使用BottomSheetDialog实现,本文将对两种方法进行讲解,其中会讲到一些使用上的细节,处理不好这些细节,会出现非常怪异的效果。 单页面添加BottomSheet效果 首先引入依赖包: compile 'com.android.support:design:27.1.1' 页面布局如下: < ? xml version = "1.0" encoding = "utf-8" ? > < android . support . design . widget . CoordinatorLayout xmlns : android = "http://schemas.android.com/apk/res/android" xmlns : app = "http://schemas.android.com/apk/res-auto" android :

Touch intercepted after fling

怎甘沉沦 提交于 2019-12-06 11:58:39
Recently I am experiencing some issues with my scrollview. Touch events don't reach elements inside a scrollview after a fling has happened. After a fling has occurred I first need to tap the view once again, after that the normal behaviour is restored. I already tried lot's of workarounds like: Manually fire a motion event (up / down) after the fling. This works but has some serious issues, I don't have to explain why I guess since this is just the same as touching the view again but that at a certain x+y. Intercept touch events and always pass them to the underlying views. But all this is

FrameLayout does not match the height of NestedScrollView

血红的双手。 提交于 2019-12-05 16:40:00
问题 I have a FrameLayout inside a NestedScrollView, as <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000"> But the FrameLayout is not filling the height of the NestedScrollView. How might I fix this? 回答1: Check This Solution Use fillViewport="true" this