I've tried searching for this but either I'm not able to find it or the examples aren't making sense to me.
I am wanting to create a custom view that I can add dynamically to a tabhost. The view would consist of a label, an edittext (number style), and two buttons (one for + and one for -). The buttons would increment/decrement the number in the edittext view. I want to be able to initialize the view with the value for the label text and edittext.
I could just create each of these views in sequence while putting them in the right order into the tabhost panel, but I think it'd be easier if I could just make a view/class/etc. that contains all the separate views, including the functionality for each part of it. I've looked at some custom view samples, but I'm not seeing how they are created in such a way that I can say something like the following:
(assuming I've created my own custom standalone view type named "MyCustomView")
I'd like to be able to define a set size for the view just because it'd be easier, but that's probably not a good idea since it wouldn't be able to scale. How do I account for resizing of the custom view?
Can someone kindly point me to the right tutorial to read? Do I have to make a separate library in order to do what I'm wanting?
I am wanting to create a custom view that I can add dynamically to a tabhost. The view would consist of a label, an edittext (number style), and two buttons (one for + and one for -). The buttons would increment/decrement the number in the edittext view. I want to be able to initialize the view with the value for the label text and edittext.
I could just create each of these views in sequence while putting them in the right order into the tabhost panel, but I think it'd be easier if I could just make a view/class/etc. that contains all the separate views, including the functionality for each part of it. I've looked at some custom view samples, but I'm not seeing how they are created in such a way that I can say something like the following:
(assuming I've created my own custom standalone view type named "MyCustomView")
B4X:
Dim nInitialValueForEditText As Int
nInitialValueForEditText = 5
Dim custView as MyCustomView
custView.initialize("i'm the label", nInitialValueForEditText)
pnlTab.AddTab2("Main", lstMain)
lstMain.Panel.AddView(custView, 0, 0, 100dip, 50dip)
I'd like to be able to define a set size for the view just because it'd be easier, but that's probably not a good idea since it wouldn't be able to scale. How do I account for resizing of the custom view?
Can someone kindly point me to the right tutorial to read? Do I have to make a separate library in order to do what I'm wanting?