How to set toast style as theme?
I do not answer the original question, I just answer the question asked in one of the comments: "Is there a table for all element names, such as android: toastFrameBackground", because it can be useful, and I can not comment, because due to the lack of a "reputation number". So do not go down. Yes, there are two files that can provide you with all the attributes used by the Android operating system.
Android Styles (styles.xml) - Android Themes (themes.xml) - Try the following:
Toast toast=new Toast(this); LayoutInflater inflater=this.getLayoutInflater(); View toastView=inflater.inflate(R.layout.toast_layout, (ViewGroup)findViewById(R.id.toastView)); TextView txtDate=(TextView)toastView.findViewById(R.id.txtDate); txtDate.setText("toast appeared at "+Calendar.getInstance().getTime().toLocaleString()); toast.setGravity(Gravity.CENTER, 0, 0); toast.setView(toastView); toast.show();