0
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);
}
}
나는 위의 코드를 사용하여 화면에 이미지를 동적으로 생성했습니다. 이제 이미지 셀 위에 텍스트를 추가하고 싶습니다. 미리 감사드립니다.Android에서 ImageView를 통해 텍스트 추가하기
@Triode 감사 텍스트를 겹쳐 수있는 FrameLayout이를 사용하여 이미지 뷰를 구현이다 – Triode