本文是基于android的SurfaceView的动态画图效果,实现静态和动态下的正弦波画图,可作为自己做图的简单参考,废话不多说,先上图,
静态效果:
动态效果:
比较简单,代码注释的也比较详细,易懂,我就直接上代码了吧:
1.main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<SurfaceView
android:layout_width="fill_parent"
android:layout_height="600px"
android:id="@+id/surfaceview_draw"/>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:layout_below="@id/surfaceview_draw"
android:layout_marginLeft="7dip"
android:id="@+id/simpledraw_btn"
android:text="简单绘图"
android:layout_width="wrap_content"
android:layout_height="wrap_conten