Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Crouton is an Android library project designed to replace Toast Notifications.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 Sample
Octocat-spinner-32 library
Octocat-spinner-32 screenshots
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
README.md

Crouton

Crouton is an Android library project designed to replace Toast Notifications.

It's a free implementation of this Cyril Mottier blog post : in-layout notifications.

Crouton InfoCrouton ConfirmCrouton Alert

Usage

  1. Include a CroutonView widget in your layout.

    <com.neogb.crouton.CroutonView
        android:id="@id/crouton"
        style="@style/crouton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />
    

    CroutonView's parent must be a FrameLayout or a RelativeLayout.

    You can also use layout_alignParentBottom instead of layout_alignParentTop, of course these two attributes works only with a RelativeLayout as parent.

  2. In your onCreate method, find the CroutonView from your layout.

    mCroutonView = (CroutonView) findViewById(R.id.crouton);

  3. In your onResume method, call CroutonView.onResume().

    @Override
    protected void onResume() {
        super.onResume();
        mCroutonView.onResume();
    }
    
  4. Now you're ready to show some croutons.

    Create a Crouton for any CharSequence:

    Crouton.makeText(mCroutonView, CharSequence, int).show();
    

    Create a Crouton with a String from your application's resources:

    Crouton.makeText(mCroutonView, int, int).show();
    

    The third parameter must be a Crouton style :

    • Crouton.STYLE_INFO
    • Crouton.STYLE_CONFIRM
    • Crouton.STYLE_ALERT

Developed by

Guillaume BOUERAT

License

Copyright (C) 2012 Guillaume BOUERAT (https://github.com/GBouerat/Crouton)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Something went wrong with that request. Please try again.