我想创建动态ImageView,但它没有出现,有什么帮助吗?
@Override public boolean onTouchEvent(MotionEvent event) {
RelativeLayout myLayout = new RelativeLayout(this);
ImageView stone = new ImageView(this);
stone.setImageResource(R.drawable.pedra);
stone.setVisibility(View.VISIBLE);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
myLayout.addView(stone, lp);
return true;
}