All Projects → CooLoongWu → AddSubController

CooLoongWu / AddSubController

Licence: other
用来实现类似购物车里数量加减的一个控制器,按钮背景均使用shape绘制,可根据项目自定义颜色

Programming Languages

java
68154 projects - #9 most used programming language

说明

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

主要使用两个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>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].