QuantityView Android Widget

repository·master·Indexed 19 days ago

https://github.com/himanshu-soni/quantityview

An Android widget for incrementing and decrementing numeric values via add and remove buttons. Supports customization of button backgrounds, text, colors, and quantity limits through XML attributes.

Tokens
751
Snippets
3
Records
3
Agent score
15%

What's inside QuantityView

  1. Use QuantityView in XML layout

    master

    Include the QuantityView widget in your XML layout file. You can set the initial quantity using the app:qv_quantity attribute.

    <me.himanshusoni.quantityview.QuantityView
    	xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/quantityView_default"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:qv_quantity="10" />
  2. Customize QuantityView attributes

    master

    You can customize the appearance and behavior of the QuantityView using the following XML attributes:

    AttributeTypeDescription
    app:qv_addButtonBackgroundcolor or drawableBackground for the add button
    app:qv_addButtonTextstringText for the add button
    app:qv_addButtonTextColorcolorText color for the add button
    app:qv_removeButtonBackgroundcolor or drawableBackground for the remove button
    app:qv_removeButtonTextstringText for the remove button
    app:qv_removeButtonTextColorcolorText color for the remove button
    app:qv_quantityBackgroundcolor or drawableBackground for the quantity display
    app:qv_quantityTextColorcolorText color for the quantity display
    app:qv_quantityintegerInitial quantity value
    app:qv_quantityPaddingdimensionPadding for the quantity display
    app:qv_maxQuantityintegerMaximum allowed quantity
    app:qv_minQuantityintegerMinimum allowed quantity
    app:qv_quantityDialogbooleanWhether to use a dialog for quantity selection
    <!-- Example of applying customization attributes -->
    <me.himanshusoni.quantityview.QuantityView
        android:id="@+id/quantityView_custom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:qv_quantity="5"
        app:qv_minQuantity="0"
        app:qv_maxQuantity="100"
        app:qv_addButtonText="+"
        app:qv_removeButtonText="-"
        app:qv_quantityTextColor="#FF0000" />