1
저는 이미지 수평 스크롤 스트립 전에 포착 구조체 및 I 현재 예기치 클리핑
BUT 등이 띠 모양의 항목 I 단지
구조체를 볼 것으로 할 프로세스에서 함수는 다음과 같이 구현됩니다.
FrameLayout getImageContainer(){
//Call custom function from application class to get screen size
DeviceScreenSize dss = app.getScreenSize();
//Calculate thumbnail size based on 15% size of the minimum of screen sizes
//imgWidth and imgHeight are globals to use for thumbnail sizes
imgWidth = imgHeight = Math.min(dss.getWidth(), dss.getHeight())*15/100;
//Create container for thumbnail(ImageView) and erase button
FrameLayout fl = new FrameLayout(this);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
fl.setLayoutParams(params);
//ImageView containing thumbnail of captured image (has 15% size from min screen side)
ImageView imv = new ImageView(this);
imv.setId(R.id.imvFrame);
imv.setLayoutParams(new LayoutParams(imgWidth, imgHeight));
imv.setScaleType(ScaleType.CENTER_CROP);
//Button to erase captured image from strip without removing from device (has 7% size from min screen side)
Button imgClose = new Button(this);
imgClose.setId(R.id.btnErase);
imgClose.setBackgroundResource(R.drawable.ic_closebutton);
params = new LayoutParams(
Math.min(dss.getWidth(), dss.getHeight())*7/100,
Math.min(dss.getWidth(), dss.getHeight())*7/100);
//Snap the center point of imgClose button to the right-top corner of ImageView
params.topMargin = -Math.min(dss.getWidth(), dss.getHeight())*7/200;
params.leftMargin = imgWidth-Math.min(dss.getWidth(), dss.getHeight())*7/200;
imgClose.setLayoutParams(params);
//Add all children to FrameLayout
fl.addView(imv);
fl.addView(imgClose);
//Add to FrameLayout the additional right-side child as whitespace between different images
View v = new View(this);
params = new LayoutParams(Math.min(dss.getWidth(), dss.getHeight())*5/200, imgWidth);
params.leftMargin = imgWidth+Math.min(dss.getWidth(), dss.getHeight())*7/200;
v.setLayoutParams(params);
fl.addView(v);
return fl;
}
다음 함수는 모든 tim 이미지 후 전자는 캡처 :
여기protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case CAMERA_IMAGE_REQUEST: {
//Get image container to place the thumbnail of captured image
FrameLayout container = getImageContainer();
((ImageView)container.findViewById(R.id.imvFrame)).setTag(imageFolderPath + File.separator + imageName);
((ImageView)container.findViewById(R.id.imvFrame)).setOnClickListener(openImage);
((Button)container.findViewById(R.id.btnErase)).setOnClickListener(eraseImage);
.......................
.......................
((ImageView)container.findViewById(R.id.imvFrame)).setImageBitmap(bitmap);
imvPhotoFrame.addView(container);
}
break;
.......................
.......................
}
}
}
, imvPhotoFrame가있는 LinearLayout은 다음과 같습니다
.............
<HorizontalScrollView
android:id="@+id/svHorizontalScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="horizontal" >
<LinearLayout
android:id="@+id/imvPhotoFrame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
.............
그래서, 첫 번째 이미지에서 스트립을 얻기 위해 무엇을해야하는지?