使用进度条控制画布控件缩放
- 移除顶部放大/缩小按钮,改用底部SeekBar进度条控制 - 缩放范围0.1-5.0对应进度条0-100 - 添加setScaleFactor()方法
This commit is contained in:
@@ -13,7 +13,7 @@ import android.widget.FrameLayout;
|
||||
|
||||
public class ZoomContainerView extends FrameLayout {
|
||||
private float scaleFactor = 1.0f;
|
||||
private float minScale = 0.5f;
|
||||
private float minScale = 0.1f;
|
||||
private float maxScale = 5.0f;
|
||||
private static final float ZOOM_STEP = 0.25f;
|
||||
|
||||
@@ -98,6 +98,12 @@ public class ZoomContainerView extends FrameLayout {
|
||||
return scaleFactor;
|
||||
}
|
||||
|
||||
public void setScaleFactor(float scale) {
|
||||
scaleFactor = Math.max(minScale, Math.min(scale, maxScale));
|
||||
requestLayout();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void resetZoom() {
|
||||
scaleFactor = 1.0f;
|
||||
invalidate();
|
||||
|
||||
Reference in New Issue
Block a user