Android Question Custom View / Designer

Guenter Becker

Active Member
Licensed User
Hello,
my question is focused on building a desginerable custom control.

I knew that I can set/retrive the Designer "Text Properties" by code using the *Lbl View" of the "Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)". But I'm missing to do the same with the Background Properties like Drawable/Border a.s.o. because I can not find the belonging Props in the Base Object or the mbase B4XView. I tried mbase.GetView but there is also no access to the Props. By the way I know that I can creat own DesignerProperties by code but I think the requested Props are still there and it will be silly to code them twice.

Question: Does Anyone can tell me how to get and set the Background Properties Values of the mbase View by code? A B4A code snipped would be fine.

Thank You in Advance
Guenter
 

Alexander Stolte

Expert
Licensed User
Question: Does Anyone can tell me how to get and set the Background Properties Values of the mbase View by code? A B4A code snipped would be fine.
B4X:
mBase.Color = xui.Color_Red
or in the designer
1667916715787.png
 
Upvote 0

Guenter Becker

Active Member
Licensed User
Hey
Ok, I know that but what is with the other properties for the border, the gradient and the image? There are no properties listed in mbase for these.
 
Upvote 0

Guenter Becker

Active Member
Licensed User
Ok, that is what I tried but it did not solve the problem!
If I do it (objPanel = mbase) the Panel View deals only with the properties Color and Background
Background = current Drawable state like ColorDrawable or GradientDrawable or BitmapDrawable
Color = Background Color if Background state is ColorDrawable

What I need to handle by code are all the values of the Background properties of the different Background states, in Detail:

Background = ColorDrawable, Properties: Color/Bordercolor/Borderwidth/radius?
Background = GradientDrawable, Properties: Orientation/First color/Second color?
Background = BitmapDrawable, Properties: ImageFile/Gravity?

Any Idea how to get access? If not I hope erel knew it?
 
Upvote 0
Top