I'm displaying a SnackBar
at the top of my view by implementing the following:
Snackbar snack = Snackbar.make(rootlayout, "SnackBar Test!", Snackbar.LENGTH_LONG);
View view = snack.getView();
FrameLayout.LayoutParams params =(FrameLayout.LayoutParams)view.getLayoutParams();
params.gravity = Gravity.TOP;
view.setLayoutParams(params);
snack.show();
This is working perfectly, but the problem is that the activity is full screen / NoTitleBar, I have done this by adding the following to the activity in Manifest:
<activity android:name=".MyActivty"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
When I run it I get the following error:
Caused by: android.view.InflateException: Binary XML file line #41: Error inflating class <unknown>
This only happens when I set the activity theme to Theme.NoTitleBar.Fullscreen
.
Your problem is the following. First Snackbar dependes on the support design library. Which works with AppCompatActivity. The theme that you are trying to use is not from the suport library. In order to use fullscreen appcompat theme you can use this
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Change your theme to this in the manifest also and try if it is going to work.