Android开发之自定义Toast(吐司)

    xiaoxiao2022-07-03  125

    先看下效果一目了然:

    直接上代码

    Toast toast = Toast.makeText(getApplicationContext(), "带图片的Toast", Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); LinearLayout toastView = (LinearLayout) toast.getView(); ImageView imageCodeProject = new ImageView(getApplicationContext()); imageCodeProject.setImageResource(R.mipmap.duigou); toastView.addView(imageCodeProject, 0); toast.show();

    请看博主链接:博主直达

    最新回复(0)