2012-06-27 6 views
1

사용자가 갤러리의 이미지를 볼 수있는 preView로 popupWindow를 만들려고합니다. 하지만 첫 번째와 두 번째 이미지가 숨겨져 있으며 scrollView의 끝에서 스크린 샷처럼 빈 공간이 있습니다.PopupWindow의 HorizontalScrollView

enter image description here

나는
layout.addView (이미지 뷰)를 사용하려고 해요;

private void showAttachmentPopup() { 
    LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    View popupView = layoutInflater.inflate(R.layout.attachemnts_file_popup, null, false); 
    PopupWindow pw = new PopupWindow(popupView, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, true); 
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); 
    params.addRule(RelativeLayout.BELOW, findViewById(R.id.layout_sent).getId()); 
    popupView.setLayoutParams(params); 
    LinearLayout layout_attachment = (LinearLayout) popupView.findViewById(R.id.layout_attachment); 
     RoundedImageView roundedImageView = new RoundedImageView(this); 
     LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER); 
     lp.setMargins(5, 5, 5, 5); 
     roundedImageView.setLayoutParams(lp); 
     roundedImageView.setScaleType(RoundedImageView.ScaleType.FIT_XY); 
     roundedImageView.setImageBitmap(bitmap); 
     layout_attachment.addView(roundedImageView); 

    pw.setOutsideTouchable(true); 
    pw.setBackgroundDrawable(new BitmapDrawable()); 
    pw.showAtLocation(mBtnAttach, Gravity.BOTTOM | Gravity.LEFT, locateView(mBtnAttach).bottom, locateView(mBtnAttach).right); 
} 

그리고이 비트 맵을 몇 시간 추가하려고하면이 오류가 발생합니다. 내 xml에서 HorizontalScrollView 및 LinearLayout 여기에

+0

코드 일부를 게시 할 수 있습니까? –

답변

1

나는 (같은데) 같은 문제가 있었는데, 똑같이 보였다. 저를 도와 무엇

는 adjustViewBounds을 설정했다 :

roundedImageView.setAdjustViewBounds(true); 

그것은 귀하의 케이스에 맞는 희망!

관련 문제