php视频教程下载,汉语拼音字母歌下载,柔韧训练
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button = (button) findviewbyid(r.id.button); button.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub toast toast = new toast(mainactivity.this); view view = layoutinflater.from(mainactivity.this).inflate(r.layout.toast, null); imageview imageview = (imageview) view.findviewbyid(r.id.image); imageview.setimageresource(r.drawable.a1); // 居中显示 toast.setgravity(gravity.center, 0, 0); // 加载自定义布局 toast.setview(view); toast.show(); } }); }
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <imageview android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginright="10dp" /> <textview android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="自定义吐司通知" android:textcolor="#000000" /> </linearlayout>
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android studio 解决logcat无过滤工具栏的操作
Android Studio 恢复小窗口停靠模式(Docked Mode)
Android studio保存logcat日志到本地的操作
Android Studio快捷键生成TAG、Log.x日志输出介绍
网友评论