最近在做声纹相关的东西,在画页面时,因为设计不在家,所以就在即琢磨着,突发奇想的如果能模拟声纹波动的效果,岂不是很形象,所以在这边做了个模拟声纹波动的动画,但是首先声明,不是真的检测外部的声音而实时波动的,仅仅是个模拟声纹的动画效果,直接上代码:
layout xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
tools:context="winter.winterdemos.PathViewActivity">
<winter.winterdemos.WaveView
android:id="@+id/pathView"
android:layout_width="360dp"
android:layout_height="200dp"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
<TextView
android:layout_width="500dp"
android:layout_height="2dp"
android:background="@color/title_color"
android:layout_centerI