Giter VIP home page Giter VIP logo

highlightview's Introduction

HighlightView

GitHub stars GitHub forks GitHub issues GitHub license

支持高亮灯光移动效果的 TextView、ImageView、FrameLayout、LinearLayout、RelativeLayout

show

第一步,根目录build.gradle

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

第二步,需要引用的build.gradle (最新版本

    dependencies {
        implementation 'com.github.FlyJingFish:HighlightView:1.2.1'
    }

第三步,使用说明

设置 HighlightTextView 示例

 <com.flyjingfish.highlightviewlib.HighlightTextView
    android:id="@+id/highlightTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text=" Hello World! "
    android:gravity="center"
    android:textStyle="bold"
    android:textColor="@color/black"
    android:layout_marginTop="10dp"
    app:highlight_view_highlightWidth="40dp"
    app:highlight_view_highlightColor="#E6ffffff"
    app:highlight_view_autoStart="true"
    app:highlight_view_duration="2500"
    app:highlight_view_repeatCount="-1"
    app:highlight_view_repeatMode="restart"
    app:highlight_view_highlightRotateDegrees="30"
    app:highlight_view_startDirection="from_left"
    android:textSize="30sp"/>

设置 HighlightImageView 示例

<com.flyjingfish.highlightviewlib.HighlightImageView
    android:id="@+id/highlightImageView"
    android:layout_width="154dp"
    android:layout_height="64dp"
    android:scaleType="fitXY"
    android:src="@mipmap/e_bank"
    app:highlight_view_highlightWidth="30dp"
    app:highlight_view_highlightColor="#b3ffffff"
    app:highlight_view_autoStart="true"
    app:highlight_view_duration="2500"
    app:highlight_view_repeatCount="-1"
    app:highlight_view_repeatMode="restart"
    app:highlight_view_highlightRotateDegrees="30"
    app:highlight_view_startDirection="from_left"
    android:layout_marginTop="10dp"/>

设置 ViewGroup 示例

<com.flyjingfish.highlightviewlib.HighlightLinearLayout
    android:id="@+id/highlightLinearLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center"
    app:highlight_view_highlightWidth="40dp"
    app:highlight_view_highlightColor="#E6ffffff"
    app:highlight_view_autoStart="true"
    app:highlight_view_duration="2500"
    app:highlight_view_repeatCount="-1"
    app:highlight_view_repeatMode="restart"
    app:highlight_view_highlightRotateDegrees="30"
    app:highlight_view_startDirection="from_left">
    <ImageView
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:scaleType="fitXY"
        android:src="@mipmap/camera"
        android:layout_marginTop="10dp"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="视频连接中"
        android:gravity="center"
        android:textStyle="bold"
        android:textColor="@color/black"
        android:textSize="16sp"/>

</com.flyjingfish.highlightviewlib.HighlightLinearLayout>

属性一览

attr format description
highlight_view_highlightColor reference/color 高亮中心区域颜色
highlight_view_highlightWidth dimension 高亮区域宽度
highlight_view_highlightRotateDegrees float 高亮区域旋转角度
highlight_view_startDirection enum 高亮动画开始位置(from_left 从左边开始/from_top 从上边开始/from_right 从右边开始/from_bottom 从下边开始)
highlight_view_repeatCount integer 动画循环次数
highlight_view_repeatMode enum 动画循环模式(restart 动画结束后从开始位置循环下一次/reverse 动画结束后从结束位置循环下一次)
highlight_view_duration integer 动画循环一次的时间
highlight_view_autoStart boolean 开始显示控件时,是否自动开始高亮动画

HighlightAnimHolder 部分方法介绍(更多方法自行探索吧~~)

attr description
startHighlightEffect 开始动画(动画相关参数设置后在此起效)
stopHighlightEffect 结束动画
resumeHighlightEffect 继续动画
pauseHighlightEffect 暂停动画
isPaused 是否暂停动画
setInterpolator 设置插值器

例如

 highlightTextView.getHighlightAnimHolder().stopHighlightEffect()

最后推荐我写的另外一些库

highlightview's People

Contributors

flyjingfish avatar sceneren 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.