Tuesday, June 30, 2015

How to Customize Toast In Android

To Customize Toast shape and color use this.
Toast toast = Toast.makeText(getApplicationContext(), "You not Subscribe Try again", Toast.LENGTH_LONG);
                            View vieew = toast.getView();
                            //  vieew.setBackgroundColor(Color.parseColor("#BD8BDC"));
                            vieew.setBackgroundResource(R.drawable.textinputborder);
                            toast.setView(vieew);
Also use in R.drawable.textinputborder
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#83BB66" />
            <stroke android:width="1dp"
                    android:color="#1B200A" />
            <corners android:radius="20dp" />
        </shape>
    </item>
</selector>

No comments:

Post a Comment