Android笔记
——消息提示框 【若对该知识点有更多想了解的,欢迎私信博主~~】
消息提示框:Toast
常用用法:
Toast
.makeText(this, "这是消息提示框", Toast
.LENGTH_SHORT
).show();
自定义用法:
final Toast toast
=new Toast(Main26Activity
.this);
toast
.setGravity(Gravity
.CENTER
,0,0);
LinearLayout ll
=new LinearLayout(Main26Activity
.this);
ImageView imageView
=new ImageView(Main26Activity
.this);
imageView
.setBackgroundResource(R
.mipmap
.logo
);
ll
.addView(imageView
);
TextView textView
=new TextView(Main26Activity
.this);
textView
.setTextColor(Color
.parseColor("#ff0000"));
textView
.setText("hhhh");
textView
.setTextSize(20);
ll
.addView(textView
);
toast
.setView(ll
);
toast
.setDuration(Toast
.LENGTH_SHORT
);
toast
.show();
转载请注明原文地址:https://ipadbbs.8miu.com/read-31058.html