public void addNewImageToScreen (int resourceId)
{
if (mLastNewCell != null) mLastNewCell.setVisibility (View.GONE);
FrameLayout imageHolder = (FrameLayout) findViewById (R.id.image_source_frame);
if (imageHolder != null) {
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams (LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT,
Gravity.CENTER);
ImageCell newView = new ImageCell (this);
newView.setImageResource (resourceId);
imageHolder.addView (newView, lp);
newView.mEmpty = false;
newView.mCellNumber = -1;
mLastNewCell = newView;
mImageCount++;
// Have this activity listen to touch and click events for the view.
newView.setOnClickListener(this);
newView.setOnLongClickListener(this);
newView.setOnTouchListener (this);
}
}
我已经使用上面的代码在屏幕上动态生成图像。现在我想在图像单元格上添加一些文本。在此先感谢。
答案 0 :(得分:0)
ImageCell是一个实现ImageView的类,所以使用FrameLayout我可以重叠文本 谢谢@Triode