Create this customizable, reusable view

I need to create a custom reusable presentation component. I tried looking around to find out how custom views are created in android. But I'm a little confused.

I need an example or explanation of the steps I need to take to make this happen.

In my view, I need the following: two TextView and two Button , which already have programmed functionality. The button should increase or decrease the int that is displayed on the Quantity TextView .

 |----------------------------------------------------------------| | | | Name of Item --- Quantity --- (Button Minus) --- (Button Plus) | | | |----------------------------------------------------------------| 

So I would get this component by calling something like MyComp mc = new MyComp() and get the values ​​as normal ( mc.getName , mc.getQty )

+4
source share
1 answer

Please see the Android documentation for CompoundControls .

+4
source

Source: https://habr.com/ru/post/1381361/


All Articles