Git Product home page Git Product logo

numberbutton's Introduction

NumberButton

####自定义组件:购物车商品数量、增加和减少控制按钮。

####说明:

  1. 可以定义最大库存、当前数量、最大购买数量
  • 可以打开或关闭数量输入
  • 可以按钮和输入框的宽度

#####使用

  • 引入
    • compile 'ren.qinc.numberbutton:numberbutton:0.0.1'
  • 布局
<ren.qinc.numberbutton.NumberButton
    android:id="@+id/number_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    qinc:editable="true"/>
  • 初始化和设置
NumberButton numberButton = (NumberButton) findViewById(R.id.number_button);
//assert numberButton != null;
numberButton.setBuyMax(5)
        .setInventory(6)
        .setCurrentNumber(10)
        .setOnWarnListener(new NumberButton.OnWarnListener() {
            @Override
            public void onWarningForInventory(int inventory) {
                Toast.makeText(MainActivity.this, "当前库存:" + inventory, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onWarningForBuyMax(int buyMax) {
                Toast.makeText(MainActivity.this, "超过最大购买数:" + buyMax, Toast.LENGTH_SHORT).show();
            }
        });
  • 其他:
  • 你可以设置的属性有: * editable(boolean):是否可以编辑数量 * buttonWidth(dimension):按钮区域宽度 * textWidth(dimension):数量区域宽度 * textSize(dimension):数量文本大小 * textColor(color):文本颜色

image

numberbutton's People

Contributors

qinci avatar qincis avatar

Watchers

 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.