toast.getView().setBackgroundColor() will change the background color.
toast.getView().findViewById(android.R.id.message).setTextColor() will change the text color.
private void makeCustomToast(String message) {
Toast toast = Toast.makeText(mContext, message, Toast.LENGTH_SHORT);
TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
toast.getView().setBackgroundColor(mContext.getResources().getColor(R.color.blue));
v.setTextColor(mContext.getResources().getColor(R.color.white));
toast.show();
}
No comments:
Post a Comment