显示带图片的Toast提示

ImageView mView01 = new ImageView(EX05_07.this);
        mView01.setImageResource(R.drawable.icon);
        
        LinearLayout lay = new LinearLayout(EX05_07.this);
        lay.setOrientation(LinearLayout.HORIZONTAL);
        lay.addView(mView01);
        
        TextView mTextView = new TextView(EX05_07.this);
        mTextView.setText(R.string.app_url);
        Linkify.addLinks(mTextView, Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES
            | Linkify.PHONE_NUMBERS);
        Toast toast = Toast.makeText(EX05_07.this, mTextView.getText(),
            Toast.LENGTH_LONG);
        View textView = toast.getView();
        lay.addView(textView);
        
        toast.setView(lay);

        toast.show();

你可能感兴趣的:(Web)