Install QuantityView via Gradle
masterTo use QuantityView in your Android project, add the following dependency to your build.gradle file:
dependencies {
compile 'me.himanshusoni.quantityview:quantity-view:1.2.0'
}repository·master·Indexed 19 days ago
https://github.com/himanshu-soni/quantityviewAn 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.
To use QuantityView in your Android project, add the following dependency to your build.gradle file:
dependencies {
compile 'me.himanshusoni.quantityview:quantity-view:1.2.0'
}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" />You can customize the appearance and behavior of the QuantityView using the following XML attributes:
| Attribute | Type | Description |
|---|---|---|
app:qv_addButtonBackground | color or drawable | Background for the add button |
app:qv_addButtonText | string | Text for the add button |
app:qv_addButtonTextColor | color | Text color for the add button |
app:qv_removeButtonBackground | color or drawable | Background for the remove button |
app:qv_removeButtonText | string | Text for the remove button |
app:qv_removeButtonTextColor | color | Text color for the remove button |
app:qv_quantityBackground | color or drawable | Background for the quantity display |
app:qv_quantityTextColor | color | Text color for the quantity display |
app:qv_quantity | integer | Initial quantity value |
app:qv_quantityPadding | dimension | Padding for the quantity display |
app:qv_maxQuantity | integer | Maximum allowed quantity |
app:qv_minQuantity | integer | Minimum allowed quantity |
app:qv_quantityDialog | boolean | Whether 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" />