を表示することができます。
こんな感じ
- ImageView v = new ImageView(this);
- v.setImageResource(R.drawable.addnote_off);
- toast = new Toast(this);
- toast.setDuration(Toast.LENGTH_LONG);
- toast.setView(v);
- toast.show();
View ならばOKなので、xml でレイアウトを
定義した場合は Infrater を使います。
- LayoutInflater inflater = getLayoutInflater();
- View v = inflater.inflate(R.layout.iv, null);
- toast = new Toast(this);
- toast.setDuration(Toast.LENGTH_LONG);
- toast.setView(v);
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/addnote_off" />
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="hello toast"
- android:textColor="#000000"
- android:background="#ffffff" />
- </LinearLayout>
0 件のコメント:
コメントを投稿