android-coordinatorlayout

CoordinatorLayout NullPointerException in onTouchEvent

自作多情 提交于 2019-12-04 04:05:28
I am getting NullPointerException in onTouchEvent of CoordinatorLayout . I am using DrawerLayout with CollapsingToolbarLayout of android support AppCompat v23.0.0 library. My observation is crash happen randomly while scrolling CollapsingToolbarLayout or click on drawer items. Is there anyone facing this issue? any work around to avoid this exception? Logcat: 08-22 15:16:34.657: E/AndroidRuntime(27596): java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.MotionEvent.getX()' on a null object reference 08-22 15:16:34.657: E/AndroidRuntime(27596): at android.view

Snackbar with CoordinatorLayout disable dismiss

无人久伴 提交于 2019-12-04 04:02:12
I am using the support FloatingActionButton Snackbar CoordinatorLayout I need the CoordinatorLayout so that if SnackBar is shown the FloatingActionButton moves up to make room for the Snackbar. For better understanding check this video . I am using SnackBar for double-back to exit the application, but the SnackBar can be dismissed. Is there a way to disable the dismiss on the SnackBar? Snackbar snackbar = Snackbar.make(view, R.string.press_back_again_to_exit, Snackbar.LENGTH_SHORT); snackbar.setAction(R.string.ok, new View.OnClickListener() { @Override public void onClick(View v) { } });

How to dim background when using the BottomSheet from the support library?

我的梦境 提交于 2019-12-04 03:15:20
How can the background be dimmed just like it is shown here ? I've set it up normally using the CoordinatorLayout and the BottomSheetBehavior . This will simply show a bottom sheet. public class MyBottomSheet extends BottomSheetDialogFragment { private static final String TAG = "MyBottomSheet"; @NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); final View view = View.inflate(getContext(), R.layout.my_custom_view, null); dialog.setContentView(view); behavior =

footer scrolls off screen when used in CoordinatorLayout

大憨熊 提交于 2019-12-04 01:38:30
问题 I have HomeActivity which contains fragment and at the bottom it has custom navigation view as shown below. By clicking on profile pic, it replaces the fragment with UserProfileView fragment. userProfileView fragment has Collapsing toolbar inside coordinatorLayout. userprofileview.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:bind="http://schemas.android.com/apk/res-auto"

Scrolling is not working with CoordinatorLayout + parallax image + BottomSheetLayout

人盡茶涼 提交于 2019-12-03 23:50:57
Introduction I have an activity, which implements a common pattern with parallax header image and scrolling content using CoordinatorLayout , AppBarLayout and CollapsingToolbarLayout . My xml layout looks like this: <android.support.design.widget.CoordinatorLayout android:fitsSystemWindows="true" android:layout_height="match_parent" android:layout_width="match_parent"> <android.support.design.widget.AppBarLayout android:fitsSystemWindows="true" android:id="@+id/appbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">

CoordinatorLayout + AppbarLayout + Viewpager not resize child layout

十年热恋 提交于 2019-12-03 22:35:31
I have a problem using CoordinatorLayout in conjunction with ViewPager and the ViewPager: the layout does not resize correctly. Supose that the height solved includes tabs height. So when I scroll to bottom i see this: main layout code: <?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" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinator" android:layout_width="match_parent" android:layout_height="match_parent" android

Hiding Toolbar on scroll with recyclerview inside fragment

余生颓废 提交于 2019-12-03 22:12:35
I'm trying to get the toolbar to collapse on scroll when a recyclerview inside a fragment is scrolled. To start, heres my main layout: <DrawerLayout> <RelativeLayout android:id="@+id/mainRelativeLayout" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <android.support.design.widget.AppBarLayout android:id="@+id/appBarLayout" android:layout_width="match_parent" android:layout_height="wrap_content" > <Toolbar android:id="@+id/toolbar" android

CoordinatorLayout custom behavior with AppBarLayout

允我心安 提交于 2019-12-03 18:22:30
问题 I am trying to achieve a similar behavior to that of Telegram, on the settings page, that is, there is a CircleImage that when scrolling up goes to the left of the Topbar title, and when scrolling down goes to the middle of the expanded AppBarLayout. I was basing my work on this example: https://github.com/saulmm/CoordinatorBehaviorExample But in this case the original coder is recreating the Topbar twice. I dont want to do that, the default behavior of the topbar is what I need and also I

Toolbar overlaps status bar

时光总嘲笑我的痴心妄想 提交于 2019-12-03 16:34:37
问题 I've got a problem with my status bar which gets overlapped by the toolbar. I wanted to have the function that when the user scrolles the ListView down, the toolbar disappears behind the status bar so that only the tabs are visible, just like in the WhatsApp and YouTube apps. To achieve this effect or to get this function I used this line: app:layout_scrollFlags="scroll|enterAlways" into my android.support.v7.widget.Toolbar , but know as I said before, the status bar gets overlapped by the

How can BottomSheetBehavior, AppBarLayout.ScrollingViewBehavior, and AppBarLayout.Behavior work together in unison?

不想你离开。 提交于 2019-12-03 16:27:19
In the GIF below you'll see I'm having trouble coordinating (heh) an AppBarLayout , containing a CollapsingToolbarLayout , and a Persistent BottomSheet in such a way that they play nicely together Goal: Have the fragment contents , seen above in turquoise ( #26999f ), remain above, yet scroll behind, the BottomSheet, seen above in dark green (#12783e) , while also respecting the AppBarLayout and its Behavior Again, as you can see from the GIF I'm close; the fragment contents is using a custom layout_behavior , MyScrollingViewBehavior , which extends AppBarLayout.ScrollingViewBehavior In the