我有一个表面视图来执行一些绘图工作。我的视图支持放大/缩小功能。现在,当用户通过手势放大/缩小手指时,我想调整表面视图的大小,我尝试通过更改surfaceview的布局参数来调整大小。尽管这有效,但速度很慢,在做调整工作时,我看到一些大的跳跃(滞后),这是不可用的。在这里,我想知道如何有效地调整表面视图的大小(没有那个跳跃)?在运行时有效更改视图大小
这里狙击我从结构上看,
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_above="@+id/bottomMenu"
android:layout_height="match_parent">
<MySurfaceView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout> ...
而且PARAMS更改代码,
ViewGroup.LayoutParams params = surface.getLayoutParams();
params.height = (int) (750*factor);
surface.setLayoutParams(params);
你有没有考虑过使用['TextureView'](https://developer.android.com/reference/android/view/TextureView.html)? – azizbekian
请参阅http://stackoverflow.com/a/21282056/4069985 –