android-snackbar

Snackbar with CoordinatorLayout disable dismiss

荒凉一梦 提交于 2019-12-21 10:17:03
问题 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

How does Google Inbox show a snackbar covering the keyboard?

梦想的初衷 提交于 2019-12-20 10:50:53
问题 How does Google Inbox show the snackbar over (covering, layering) the keyboard? This is not the default behaviour, which I've tested with a basic coordinator layout, the keyboard open and a snackbar: the default behaviour is showing the snackbar behind the keyboard. There are many answers on SO to the question: 'How do I show the snackbar above the keyboard' , but I haven't found how to reproduce Google's own Inbox app's snackbar behaviour. Can you show me how to achieve this? 回答1: Inbox

How to set Bold text to Android Snackbar Action Text?

青春壹個敷衍的年華 提交于 2019-12-19 07:11:34
问题 We could set the color for the Action Text of Snackbar using setActionTextColor as documented in https://developer.android.com/reference/android/support/design/widget/Snackbar.html. However, is there a way to make the Text BOLD? Thanks!! 回答1: Use snackbar_action Resource ID. It turns you that you can use the same method to style the Snackbar's Action text that you use to style the Snackbar's Message text. You just have to use the Resource ID snackbar_action instead of snackbar_text . Here's

How to show Snackbar when Activity starts?

孤者浪人 提交于 2019-12-18 10:22:49
问题 I want to show android Snackbar (android.support.design.widget.Snackbar) when the activity starts just like we show a Toast . But the problem is we have to specify the parent layout when creating Snackbar like this: Snackbar.make(parentlayout, "This is main activity", Snackbar.LENGTH_LONG) .setAction("CLOSE", new View.OnClickListener() { @Override public void onClick(View view) { } }) .setActionTextColor(getResources().getColor(android.R.color.holo_red_light )) .show(); How to give parent

How to fix the Snackbar height and position?

独自空忆成欢 提交于 2019-12-18 04:13:30
问题 On Android Support Library 24.1.1 , the Snackbar was working fine: Then starting on Android Support Library 24.2.0 onwards, the Snackbar started to behave like this: On the library revision history, there is the following statement: Behavior changes: Snackbar now draws behind the navigation bar if the status bar is translucent. But the thing is that my app is full screen and it doesn't have the navigation bar or the status bar. How can I fix it? 回答1: Look this answer https://stackoverflow.com

Snackbar in Support Library doesn't include OnDismissListener()?

邮差的信 提交于 2019-12-18 03:04:43
问题 I'd like to implement the new Snackbar included in the latest Design Support Library, but the way it is offered seems counter-intuitive for my, and I assume many others', use. When the user does an important action, I want to allow them to undo it via the Snackbar, but there seems to be no way to detect when it is dismissed to do the action. It makes sense to me to do it the following way: User does action. Show Snackbar and update UI as if the action has been completed (ie it appears that

Move snackbar above the bottom bar

不想你离开。 提交于 2019-12-17 09:18:30
问题 I am facing some problems with new bottom bar. I can't force to move the snackbar above the bottom bar (this is how design guideline told me should be https://www.google.com/design/spec/components/bottom-navigation.html#bottom-navigation-specs). This is my activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas

How to disable swipe to dismiss Android Custom Snack Bar

江枫思渺然 提交于 2019-12-11 07:29:31
问题 I'm using CustomSnackBar library from GITHUB , Check this: https://github.com/TakeoffAndroid/CustomSnackBar/blob/master/app/src/main/java/com/takeoffandroid/customsnackbar/SnackBar.java This is so usefull to customize my snackbar. But I want to disable swipe to dismiss , I tried all answer's from satckoverflow but no luck still its allowing to swipe to dismiss . Kindly advise is there any way to disable swipe to dismiss this custom snack bar. Android Studio ver:2.1 compileSdkVersion 23

Set height of Snackbar in Android

不问归期 提交于 2019-12-10 23:18:07
问题 I have a Snackbar in need to set its height or set height to wrap content. Is there any way? Snackbar snack = Snackbar.make(findViewById(R.id.activity_container), "Message", Snackbar.LENGTH_SHORT); View view = snack.getView(); TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text); view.setBackgroundColor(Color.RED); tv.setTextColor(Color.WHITE); tv.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); tv.setGravity(Gravity.CENTER_HORIZONTAL); 回答1: We are going to

Viewpager intercepts snackbar dismiss

主宰稳场 提交于 2019-12-10 09:39:36
问题 Scope I have a fragment that contains a ViewPager. Each page of the viewpager contains an item fragment. When I take an action on the item fragment, I display a snackbar within the item fragment. The snackbar is part of the item fragment (the CoordinatorLayout is part of the item fragments layout). Problem The problem I am facing is that I am not allowed to dismiss the snackbar because the viewpager intercepts the swipe event and changes pages instead of letting the snackbar get dismissed.