Toast的简单使用

class ButtonDListener implements OnClickListener{
@Override
public void onClick(View v) {
Toast toast = Toast.makeText(getApplicationContext(),
"你点击了下载按钮", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
LinearLayout toastView = (LinearLayout) toast.getView();
ImageView imageCodeProject = new ImageView(getApplicationContext());
imageCodeProject.setImageResource(R.drawable.ic_launcher);
toastView.addView(imageCodeProject, 0);
toast.show();
System.out.println("ButtonListener");

}}

Toast的简单使用

你可能感兴趣的:(toast)