Giter Club home page Giter Club logo

blingbutton's Introduction

About

Android 闪烁按钮,仿映客录制小视频按钮

Gradle

Demo

<!-- 默认效果 -->
<com.sd.lib.blingbutton.FBlingButton
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:onClick="onClick" />

<com.sd.lib.blingbutton.FBlingButton
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_marginTop="5dp"
    android:onClick="onClick"
    app:bbColor="@color/colorAccent"
    app:bbNormalInside="20dp" />

<com.sd.lib.blingbutton.FBlingButton
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:onClick="onClick"
    app:bbBlingInsideDelta="0dp"
    app:bbBlingOutsideDelta="-20dp"
    app:bbSelectedInside="50dp"
    app:bbSelectedOutside="80dp" />

<com.sd.lib.blingbutton.FBlingButton
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:onClick="onClick"
    app:bbBlingInsideDelta="10dp"
    app:bbBlingOutsideDelta="-10dp"
    app:bbSelectedInside="70dp"
    app:bbSelectedOutside="80dp" />
```xml

```java
public class MainActivity extends AppCompatActivity implements View.OnClickListener
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public void onClick(View v)
    {
        // 切换状态
        v.setSelected(!v.isSelected());
    }
}

支持的属性

<resources>

    <declare-styleable name="LibBlingButton">
        <!-- 正常状态内边直径,默认0 -->
        <attr name="bbNormalInside" format="dimension" />

        <!-- 正常状态外边直径,默认70% -->
        <attr name="bbNormalOutside" format="dimension" />

        <!-- 选中状态内边直径,默认90% -->
        <attr name="bbSelectedInside" format="dimension" />

        <!-- 选中状态外边直径,默认100% -->
        <attr name="bbSelectedOutside" format="dimension" />

        <!-- 闪烁状态内边直径相对于选中状态内边直径的偏移量,默认10% -->
        <attr name="bbBlingInsideDelta" format="dimension" />

        <!-- 闪烁状态外边直径相对于选中状态外边直径的偏移量,默认0 -->
        <attr name="bbBlingOutsideDelta" format="dimension" />

        <!-- 状态切换的动画时长,默认300毫秒 -->
        <attr name="bbStateDuration" format="integer" />

        <!-- 闪烁一次动画时长,默认500毫秒 -->
        <attr name="bbBlingDuration" format="integer" />

        <!-- 颜色,默认白色 -->
        <attr name="bbColor" format="color" />
    </declare-styleable>

</resources>

blingbutton's People

Contributors

zj565061763 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

858277721c

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.