case R.id.btn_3: Toast my = Toast.makeText(MainActivity.this, "short", Toast.LENGTH_SHORT); //设置显示的位置 my.setGravity(Gravity.CENTER_HORIZONTAL, 60, 40); //返回视图 LinearLayout lin = (LinearLayout) my.getView(); ImageView img = new ImageView(MainActivity.this); img.setImageResource(R.drawable.ic_launcher); //把图片加入到布局里,并且在文字之上 lin.addView(img, 0); my.show(); break;
时间: 2024-10-18 21:21:17