2013-04-30 2 views
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를 통해 텍스트 추가하기

+0

@Triode 감사 텍스트를 겹쳐 수있는 FrameLayout이를 사용하여 이미지 뷰를 구현이다 – Triode

답변

0

ImageCell로는 클래스 그게 그렇게 다음 FrameLayout이 내부 RelativeLayout의 것을 추가하면 RelativeLayout의에서 이미지 뷰와 텍스트 뷰를 추가하지 못할 이유는 거기에

관련 문제