Giter Site home page Giter Site logo

voiceline's Introduction

VoiceLine,一个可以根据麦克风音量大小,显示一些波形效果的控件。如图,也有一些自定义属性,包括波形的颜色,灵敏度等。

image

引用方法:

implementation 'com.github.nanyuweiyi:voiceline:1.0.1'

自定义属性列表如下:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="voiceView">
        <!--中间线的颜色,就是波形的时候,大家可以看到,中间有一条直线,就是那个-->
        <attr name="middleLine" format="color" />
        <!--中间线的高度,因为宽度是充满的-->
        <attr name="middleLineHeight" format="dimension" />
        <!--波动的线的颜色,如果是距形样式的话,刚是距形的颜色-->
        <attr name="voiceLine" format="color" />
        <!--波动线的横向移动速度,线的速度的反比,即这个值越小,线横向移动越快,越大线移动越慢,默认90-->
        <attr name="lineSpeed" format="integer" />
        <!--所输入音量的最大值-->
        <attr name="maxVolume" format="float" />
        <!--灵敏度,默认值是4-->
        <attr name="sensibility">
            <enum name="one" value="1" />
            <enum name="two" value="2" />
            <enum name="three" value="3" />
            <enum name="four" value="4" />
            <enum name="five" value="5" />
        </attr>
        <!--精细度,绘制曲线的时候,每几个像素绘制一次,默认是1,一般,这个值越小,曲线越顺滑,
            但在一些旧手机上,会出现帧率过低的情况,可以把这个值调大一点,在图片的顺滑度与帧率之间做一个取舍-->
        <attr name="fineness">
            <enum name="one" value="1" />
            <enum name="two" value="2" />
            <enum name="three" value="3" />
        </attr>
    </declare-styleable>
</resources>

实际使用过程中,可以这样配置:

    <com.nanyuweiyi.voiceline.VoiceLineView
        android:id="@+id/voicLine"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        voiceView:maxVolume="200"
        voiceView:middleLine="@android:color/holo_red_light"
        voiceView:middleLineHeight="1dp"
        voiceView:fineness="three"
        voiceView:rectSpace="2dp"
        voiceView:sensibility="four"
        voiceView:voiceLine="@android:color/holo_red_light" /> 

其它

Star是对我的最大支持. 谢谢

voiceline's People

Contributors

nanyuweiyi avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.