How can i change default toast message color and background color in android? -


i want create toast message background color white , message color black.

how can create it?

my toast message is:

toast.maketext(logpage.this, "please give feedback...", 3000).show();

i wanted create in method not in oncreate().

you can create custom toast message below :

toast toast = new toast(context); toast.setduration(toast.length_long);  layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service);  view view = inflater.inflate(r.layout.your_custom_layout, null); toast.setview(view); toast.show(); 

one textview can put inside layout file , give background , textcolor want.

also can following won't need custom layout file :

toast toast = toast.maketext(context, r.string.string_message_id, toast.length_long); view view = toast.getview(); view.setbackgroundresource(r.drawable.custom_backgrround); textview text = (textview) view.findviewbyid(android.r.id.message); /*here can above textview text.settextcolor(color.parsecolor("#000000"));*/ toast.show(); 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -