在Toast 中顯示圖片

   

 

Drawable adDrawable;// Your Drawable

Bitmap bitmap; //Your bitmap

 

 

Toast toast newToast(this);

        ImageView view = new ImageView(this);

        view.setBackground(adDrawable);//set drawable

       //set bitmap  看要設定Drawable 還是 bitmap 選一個即可

//        view.setImageBitmap(bitmap);

        toast.setGravity(Gravity.BOTTOM,0,0);//set where to show 

        toast.setView(view);

        toast.setDuration(Toast.LENGTH_LONG);

        toast.show();

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Deyu 的頭像
    Deyu

    西瓜是肥貓

    Deyu 發表在 痞客邦 留言(0) 人氣()