3

I am using keyboardsurfer's crouton library as a replacement for toasts. I am curious if there is an easy way to spawn the crouton from the bottom rather than the action bar. I looked at Configuration but didn't notice anything that would help me.

theblang
  • 10,215
  • 9
  • 69
  • 120

2 Answers2

3

See: https://github.com/keyboardsurfer/Crouton/issues/84 which leads to https://github.com/keyboardsurfer/Crouton/pull/132 which leads to https://github.com/keyboardsurfer/Crouton/issues/169 :(

In short: not available yet but you'd simply need to take the proposed pull request and format it to the new Android Studio source tree structure.

Vincent Mimoun-Prat
  • 28,208
  • 16
  • 81
  • 124
  • I guess I could make an invisible `ViewGroup` that is floated to the bottom, and attach the `crouton` to that with `Crouton.makeText(Activity, int, Style, ViewGroup)`? – theblang Jul 28 '14 at 01:36
3

You can create an empty LinearView in your activity xml file and make it as a footer. Make sure to set it's visibility as gone. Something like below:

<LinearLayout
           android:id="@+id/croutonview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="bottom" >

  </LinearLayout>

Then call the crouton.makeText() with an extra parameter having this linearview's resource id. Something like this:

Crouton.makeText( this, "crouton message" de.keyboardsurfer.android.widget.crouton.Style.INFO,(ViewGroup)findViewById(R.id.croutonview)) .show();

Hope it helps!

deepak
  • 72
  • 4