Android Question How do I create a ColorDrawable Designer property for a CustomView?

Widget

Well-Known Member
Licensed User
Longtime User
My CustomView has two panels, the default panel and an embedded panel.
The embedded panel needs to have its own ColorDrawable property and I'd like to have this ColorDrawable property accessible in the Designer.

This is what I'd like to have:
B4X:
#DesignerProperty: Key: EmbedDrawable, DisplayName: Embed Drawable,  FieldType: ColorDrawable, DefaultValue: NULL, Description: The ColorDrawable for the embeded panel

But B4A doesn't accept "FieldType: ColorDrawable" as a field type for a DesignerProperty.

Is there a solution?

TIA
 

Widget

Well-Known Member
Licensed User
Longtime User
Have you tryed simply: FieldType: Color

Oops. I should have said I wanted a Designer property similar to Base Background > Drawable which gives me the options of ColorDrawable, GradientDrawable and BitmapDrawable. See picture.

I could create 4 individual properties for GradientDrawable, namely CornerRadius, Orientation, FirstColor and SecondColor. But before I do that I was wondering if there is a predefined property type that I could use.

TIA
 

Attachments

  • DesignerDrawableProperty.PNG
    4.5 KB · Views: 169
Upvote 0

Widget

Well-Known Member
Licensed User
Longtime User
I guess that you are already using the "base background" property for the first panel, right?

Correct

If so then you will need to add the four properties and create the ColorDrawable in your code. There is currently no ColorDrawable field type.

I was afraid of that. I will use the 4 individual properties as suggested.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…