안녕하세요 안드로이드 초보입니다.
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:id="@+id/snapShot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#4d000000"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int width, height;
width = this.getResources().getDisplayMetrics().widthPixels;
int snap_width = mBitmap.getWidth();
int snap_height = mBitmap.getHeight();
float di = (float)snap_width/(float)width;
height = (int)((float)snap_height/di);
reBitmap = Bitmap.createScaledBitmap(mBitmap,width,height,true);
canvas.drawBitmap(reBitmap,0.0f,0.0f,null);
}
Bitmap bitmap = BitmapFactory.decodeByteArray(snapShotDataBuffer,0,snapShotDataBuffer.length);
BitmapView bitmapView = new BitmapView(this,bitmap);
linearLayout.removeAllViewsInLayout();
linearLayout.addView(bitmapView);
위 코드와 같이 xml에서 scrollview 안에 LinearLayout을 설정하였고
Bitmap을 화면 크기에 맞춰 LinearLayout에 넣도록 하였습니다.
문제는 이미지가 가로로 바뀌었을 때 밑에 부분이 짤리는데 스크롤이 나타나지 않습니다.
구글링을 많이 했는데 무엇이 문제인지 잘 모르겠네요