SnackBar on Java Android without changing the theme

When I created a snack bar on Android, the following error occurred: "java.lang.illegalstateexception: you need to use the theme.appcompat theme (or descendants)" in this activity

I don't want to change the theme of the activity to appcompat. Is there a way to use the fast food bar without changing the theme?

resolvent:

You are using appcompat-v7 (appcompatactivity, theme. Appcompat, etc.) or not. You need to keep consistent. Therefore, if you do not intend to use theme. Appcompat, please make sure you do not extend appcompatactivity

However, the design support library (the source of the official snackBar) only supports activities using appcompat-v7. If you want a snack bar without appcompat-v7, you can't use the design support library. Instead, use other implementations of the fast food bar

I just released library, which provides the official snackBar port. This port can run without appcompat-v7, but it is only applicable to projects with minsdkversion 21 or higher. This library implements a snack bar that can run on older devices, although the project has been terminated. There may be other implementations

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>