Android Question drawing different color regions on a panel

DT1111

Member
Licensed User
Longtime User
I want to draw different color regions or bands on a panel (see attachment). Any ideas I can achieve that if it is possible. Thanks.
 

Attachments

  • panel with color bands.jpg
    panel with color bands.jpg
    8.1 KB · Views: 269

DT1111

Member
Licensed User
Longtime User
Hi LucaMs

I suppose it doesn't matter if it is drawn on a canvas or a panel (not on 3 panels - just on one but three different colors).
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Something like this:

B4X:
    Activity.LoadLayout("1")
  
    Canvas1.Initialize(Panel1)
  
    Dim Rect1,Rect2,Rect3 As Rect
    Rect1.Initialize(0,0,33%x,Panel1.Height)
    Rect2.Initialize(33%x,0,88%x,Panel1.Height)
    Rect3.Initialize(88%x,0,100%x,Panel1.Height)
  
    Canvas1.DrawRect(Rect1,Colors.Gray,True,1)
    Canvas1.DrawRect(Rect2,Colors.Red,True,1)
    Canvas1.DrawRect(Rect3,Colors.Blue,True,1)

Layout "1" just contains Panel1.

See attached.
 

Attachments

  • 3color.zip
    6.8 KB · Views: 254
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Something like this:

B4X:
    Activity.LoadLayout("1")
 
    Canvas1.Initialize(Panel1)
 
    Dim Rect1,Rect2,Rect3 As Rect
    Rect1.Initialize(0,0,33%x,Panel1.Height)
    Rect2.Initialize(33%x,0,88%x,Panel1.Height)
    Rect3.Initialize(88%x,0,100%x,Panel1.Height)
 
    Canvas1.DrawRect(Rect1,Colors.Gray,True,1)
    Canvas1.DrawRect(Rect2,Colors.Red,True,1)
    Canvas1.DrawRect(Rect3,Colors.Blue,True,1)

Layout "1" just contains Panel1.

See attached.


There are people here very helpful.
Thanks Steve
 
Upvote 0

DT1111

Member
Licensed User
Longtime User
Hi Steve

Thank you very much for sharing your knowledge. Yes I agree with you LucaMs that there are many helpful people in this b4a community.
 
Upvote 0
Top