Toast 自定义位置和带图

1.自定义位置ide

Toast t = Toast.makeText(Reg_FillContent_Activity.this, "用户已存在!", Toast.LENGTH_SHORT);
    t.setGravity(Gravity.CENTER, 0,0 );  //居中
    t.show();this

2.带图get

Toast toast = Toast.makeText(Reg_FillContent_Activity.this, "带图的Toast!", Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0,0 ); //居中 LinearLayout toastView = (LinearLayout) toast.getView(); ImageView p_w_picpathCodeProject = new ImageView(getApplicationContext()); p_w_picpathCodeProject.setImageResource(R.drawable.icon); toastView.addView(p_w_picpathCodeProject, 0); toast.show();
相关文章
相关标签/搜索