How to get Roundend Toast

bootstrap 4 toast
toast notification
html toast
toastr
react toast
jquery toast
bootstrap 3 toast
bootstrap snackbar

I did my toast like this:

Currently Showing Toast Like Below -

Toast toast  = Toast.makeText(MainActivity.this,"Row Inserted.",Toast.LENGTH_SHORT);
  View view = toast.getView();
  view.setBackgroundColor(COlor.GREEN);
  toast.show();

But i want to do something like this:

create shape in drawble like this

<?xml version="1.0" encoding="UTF-8"?>

<gradient
    android:angle="90"
    android:endColor="#FFC107"
    android:startColor="#FFC107"/>
<corners
    android:radius="40dp"/>

and then access it like this like

Toast toast  = Toast.makeText(AppMenusActivity.this,"Row Inserted.",Toast.LENGTH_SHORT);
    View view = toast.getView();
    view.setBackground(getResources().getDrawable(R.drawable.btngradient));
    toast.show();

Toasts, You can have the toast callback a function when it has been dismissed. Toast! ' rounded' is the class I'm applying to the toast M.toast({html: 'I am a toast! These little toasts are perfect for pate, spreads or for when you are out of crackers. Basic and elegant entertaining. Dress it up using different bread types. Add various spices that will compliment the food you are serving these with. This recipe is also a great way to use up stale bread and also makes a great snack in place of chips. The cooling racks allow the toast to cook evenly.

You can make a custom Toast. Please refer bellow example code

This is java code.

LayoutInflater inflater = SelectCyclesActivity.this.getLayoutInflater();
        View layout = inflater.inflate(R.layout.layout_toast,
                (ViewGroup) SelectCyclesActivity.this.findViewById(R.id.custom_toast_container));

        TextView text = (TextView) layout.findViewById(R.id.text);
        text.setSimpleCustomText(sMessage, Constants.SECOND_FONT);

        Toast toast = new Toast(SelectCyclesActivity.this);
        toast.setGravity(Gravity.BOTTOM, 0, 60);

        toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(layout);
        toast.show();

This is an XML file layout_toast.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/custom_toast_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/toast_bg"
    android:orientation="vertical">


    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/_10sdp"
        android:layout_marginRight="@dimen/_10sdp"
        android:padding="@dimen/_12sdp"
        android:gravity="center"
        android:textColor="#FFF"
        android:textStyle="bold" />

</LinearLayout>

This is a rounded shape for toast background. toast_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid
        android:width="@dimen/_2sdp"
        android:color="@color/colordrakGray" />
    <corners android:radius="30dp" />
</shape>

Toasts � Bootstrap, Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to class="rounded mr-2" alt=""> < strong� A plate of perfect French toast—crispy 'round the edges, custardy in the center, and capped off with an amber kiss of maple syrup—is a thing of breakfast time beauty. On the other hand, slices that turn out soggy and squishy, charred in some spots and undercooked in others well, there’s nothing worse.

Here is the easiest way and more precise -

First, call this method in your java code -

private void toastIconSuccess() {
        Toast toast = new Toast(getApplicationContext());
        toast.setDuration(Toast.LENGTH_LONG);

        //inflate view
        View custom_view = getLayoutInflater().inflate(R.layout.toast_icon_text, null);
        ((TextView) custom_view.findViewById(R.id.message)).setText("Success!");
        ((ImageView) custom_view.findViewById(R.id.icon)).setImageResource(R.drawable.ic_done);
        ((CardView) custom_view.findViewById(R.id.parent_view)).setCardBackgroundColor(getResources().getColor(R.color.green_500));

        toast.setView(custom_view);
        toast.show();
    }

And Then create this custom layout - with toast_icon_text name in your layout folder -

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/parent_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="vertical"
    app:cardBackgroundColor="#263238"
    app:cardCornerRadius="23dp"
    app:cardElevation="0dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:paddingBottom="10dp"
        android:paddingLeft="18dp"
        android:paddingRight="18dp"
        android:paddingTop="10dp">

        <ImageView
            android:id="@+id/icon"
            android:layout_width="18dp"
            android:layout_height="18dp"
            android:tint="@android:color/white"
            app:srcCompat="@drawable/ic_close" />

        <View
            android:layout_width="10dp"
            android:layout_height="0dp" />

        <TextView
            android:id="@+id/message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:maxLines="1"
            android:singleLine="true"
            android:text="Error Toast"
            android:textColor="#f2f2f2" />

        <View
            android:layout_width="10dp"
            android:layout_height="0dp" />

    </LinearLayout>

</android.support.v7.widget.CardView>

Change colors and icons as your choice.

Android Library to Make sample Cool Toast, coolToast.setStyle(CoolToast.DANGER); coolToast.make("That is a red cool toast ! ");. To set duration, position or make a rounded Toast A round of toast is as many pieces of toast as will fit in your toaster.

Android toast with background colour and rounded corners , Hi, I'm trying to create a simple toast popup in android with a custom background colour which i have created using the following code snippet. Celebrating any occasion—weddings, retirements, even a night out with good friends—is made just a little more memorable when there is a fun or meaningful toast involved. Traditional toasts are short and easy to remember. It's good to have at least one all-purpose toast in your memory bank to use as you raise your glass at the perfect moment.

Toasts, Toasts are as flexible as you need and have very little required markup. Header>. <img src="holder.js/20x20?text=%20" className="rounded mr-2" alt=" " />. A round of toast is a toaster-full, so it depends whether you’re running a 2, 4 or 8 slicer. For more info consult your butler. Posted 5 years ago. BlobOnAStick. Subscriber.

Toasts � Boosted, Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to class="rounded mr-2" alt=""> < strong� A toast question for you fine folks out there.. What are your thoughts on toasting a sandwich but eating it several hours later? Specifically, I'm making brie and apple sandwiches on French bread, but I'd like the bread to be crunchy and buttery. i don't mind if the brie has melted and then sort of, you know, un-melted by the time I eat the sandwich.

Comments
  • view.setBackgroundColor(COlor.GREEN);//set drawable xml please check and create xml file inside drawable and set in backgound
  • thanks brohh... work for me!