Comments (3)
Hi,
Normally behavior implementation going to be added on a layout, it's like the main container, not the snackbar I think. Following data will help you only if you are using a FAB.
You can add a coordinator layout, add a floating button to work with location enable disable, then pass the FAB to Snackbar.
from csnackbar.
Hi!
I am testing with FAB Although I have no problem with Android 6. I will try to implement it anyway.
I am receiving an error now when I send my view to the .contentView.
I show you the code:
ERROR:
E/AndroidRuntime: FATAL EXCEPTION: main Process: es.indra.isl.es.indra.isl.igea.android.android, PID: 11420 java.lang.ClassCastException: android.support.design.widget.CoordinatorLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams at com.chootdev.csnackbar.Snackbar.contentView(Snackbar.java:94) at es.xxxxx.xxx.xxxx.android.utils.SnackbarFactory.snackBarCustomUpload(SnackbarFactory.java:119)
SnackBarFactory:
public static void snackBarCustomUpload (Context context, String message){ View view = LayoutInflater.from(context).inflate(R.layout.custom_upload_snackbar, isCoordinatorLayout(context)); TextView tv = (TextView) view.findViewById(R.id.snackbar_text); tv.setText(message); Snackbar snackbar = new Snackbar(); snackbar.with(context,isFloatingButtonEnabled(context)) .type(Type.CUSTOM, 0xff323232) .fillParent(true) .contentView(view, 48) // <-- Line 119 .duration(Duration.INFINITE) .show(); }
public static FloatingActionButton isFloatingButtonEnabled(Context context){ if (context instanceof MainActivity){ return ((MainActivity) MainActivity.getActivity()).getmPositionButton(); }else{ return null; } }
public static CoordinatorLayout isCoordinatorLayout(Context context){ if (context instanceof MainActivity){ return ((MainActivity) MainActivity.getActivity()).getmMainLayout(); }else{ return null; } }
This only happens to me if I use a snackbar with a personalized view. If I use .type (Type.SUCCESS) or .type (Type.ERROR) it works perfectly.
from csnackbar.
@ChathuraHettiarachchi
Can you think of a solution to move the FAB?
Thank you!
from csnackbar.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csnackbar.