에 의해 imageViews 하나를 추가 할 수 없습니다하지만 내가 특정 relativeLayout
레이아웃
public void showViewOfReceiptFromSelecting(String uriString)
{
byte[] imageData = null;
try
{
InputStream fis = this.getContentResolver().openInputStream(Uri.parse((uriString)));
Bitmap imageBitmap = BitmapFactory.decodeStream(fis);
imageBitmap = Bitmap.createScaledBitmap(imageBitmap, 40, 40, false);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
imageData = baos.toByteArray();
ImageView image = new ImageView(this);
image.setImageBitmap(imageBitmap);
image.setId(counterOfReceipts);
RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
rlp.addRule(RelativeLayout.RIGHT_OF, counterOfReceipts - 1);
myRelalativelayout.addView(image, rlp); // a relative Layout i already defined earlier in the code
counterOfReceipts = counterOfReceipts + 1 ;
}
catch(IOException e) {
e.printStackTrace();
}
}
이제 문제는 하나 이상의 미리보기 이미지를 추가 할 때마다 이전 버전을 대체한다는 것입니다. 당신이 단지의 이미지를 대체 레이아웃에 새보기를 추가하지 않을 때문에 ... 내가 무엇을해야할지 알려주세요
안부 물론
얼마나 추가하고 싶은지 ... –
최대 10 개. –
u가 여기에 전체 코드를 입력하여 더 나은 솔루션을 얻을 수 있습니까? –