The Crouton should ideally display underneath the toolbar, for context-sensitive updates that don't block content actions.
I apologise if this is a double-post, because I think I initially submitted it to the wrong community.
This will be fixed in 1.0.85.
As Paul described, the issue is that the crouton wasn't attached to anything in the activity. I've fixed this in three places:
BaseActivity
. (feed, question list, question, ...) This already had a content FrameLayout
around the body fragment.FrameLayout
and discovered some assumptions we had around the truly shocking behavior of the support FragmentTransaction
and the behavior of multiple fragments.There may be other areas that don't use this base layout (like registration) which will still get obscured in the toolbar. This is the bulk of the issue though.
The Crouton library displays over the actionbar/toolbar when called from an Activity's context, without the viewgroup parameter.
Creating a small FrameLayout above your main content and attaching the crouton to this will fix the issue.
<FrameLayout
android:id="@+id/crouton"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
Note: choosing wrap-content
for your layout-height will cause the crouton to be consumed by the layout before it is properly cancelled, causing double notifications or jerky behaviour.
Crouton.makeText(
MainActivity.this,
croutonText,
croutonStyle,
R.id.crouton
).show();
Alternatively, you can directly attach it to the content view, if you wish to do it programmatically:
// Find content view and cast to ViewGroup, to attach crouton
View homeBtn = findViewById(android.R.id.content);
Crouton.makeText(
MainActivity.this,
croutonText,
croutonStyle,
(ViewGroup) homeBtn)
).show();
Toolbar
has caused me so much grief. Thanks for reporting this, will fix it up for the next update :)