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);
}
}
我已经使用上面的代码在屏幕上动态生成图像。现在我想在图像单元格上添加一些文本。提前致谢。