Android类似电商抢购倒计时源码

https://github.com/CaMnter/EasyCountDownTextureView

Android类似电商抢购倒计时源码

使用说明:

1Gradle

dependencies {

compile 'com.camnter.easycountdowntextureview:library:1.1'

}

2Attributes

<declare-styleable name="EasyCountDownTextureView">

    <attr name="easyCountRectWidth" format="dimension" />

    <attr name="easyCountRectHeight" format="dimension" />

    <attr name="easyCountRectRadius" format="dimension" />

    <attr name="easyCountRectSpacing" format="dimension" />

    <attr name="easyCountTimeColor" format="color" />

    <attr name="easyCountColonColor" format="color" />

    <attr name="easyCountBackgroundColor" format="color" />

    <attr name="easyCountColonSize" format="dimension" />

    <attr name="easyCountTimeSize" format="dimension" />

    <attr name="easyCountHour" format="integer" />

    <attr name="easyCountMinute" format="integer" />

    <attr name="easyCountSecond" format="integer" />

</declare-styleable>

 

3xml

<RelativeLayout

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:layout_marginBottom="50dp"

    android:background="#ffffffff">

    <ImageView

        android:layout_width="196dp"

        android:layout_height="158dp"

        android:layout_marginTop="26dp"

        android:scaleType="centerCrop"

        android:src="@mipmap/bg_fruit" />

    <com.camnter.easycountdowntextureview.EasyCountDownTextureView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        app:easyCountHour="6"

        app:easyCountMinute="6"

        app:easyCountSecond="26" />

</RelativeLayout>

 

4XML

Animatable animatable=draweeController.getAnimatable();

if (animatable.isRunning()){

        animatable.stop();

 }else{

        animatable.start();

 }

上一篇:CSS flex 属性


下一篇:团队冲刺7