Code Monkey home page Code Monkey logo

addsubcontroller's Introduction

说明

类似购物车的一种数量加减的控制器,具体见效果图:

主要使用两个Button和一个TextView来实现效果, 按钮背景依靠layer-list和shap的属性来绘制圆角矩形, 具体代码见drawable文件夹:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_centerInParent="true"
    android:gravity="center"
    android:orientation="horizontal">

    <Button
        android:id="@+id/btn_subtract"
        android:layout_width="50dp"
        android:layout_height="match_parent"
        android:background="@drawable/selecter_left"
        android:gravity="center"
        android:text="-"
        android:textColor="@android:color/white"
        android:textSize="32sp" />

    <TextView
        android:id="@+id/text_number"
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:background="#F1F1F1"
        android:gravity="center"
        android:text=""
        android:textSize="20sp"/>

    <Button
        android:id="@+id/btn_add"
        android:layout_width="50dp"
        android:layout_height="match_parent"
        android:background="@drawable/selecter_right"
        android:text="+"
        android:textColor="@android:color/white"
        android:textSize="20sp" />
</LinearLayout>

addsubcontroller's People

Contributors

vsloong 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.