Android Question make special panel

SMOOTSARA

Active Member
Licensed User
Longtime User
Hello guys :)

How can I make this panel?

(Please guide me with codes)
 

Attachments

  • Capture.PNG
    Capture.PNG
    9.9 KB · Views: 156

SMOOTSARA

Active Member
Licensed User
Longtime User
You can set the background to a GradientDrawable with three colors.

hi Erel


B4X:
    Private gdb As GradientDrawable
    Private GradColors(3) As Int = Array As Int(Colors.red, Colors.Yellow , Colors.Blue)
    gdb.Initialize("LEFT_RIGHT", GradColors)

I know this but I need to have a colored edge too


B4X:
Dim ColorDrawable1 As ColorDrawable
'    ColorDrawable1.Initialize2(colors.red,7000dip,2dip,Colors.Red)
'    Panel_advertising.Background=ColorDrawable1

upload_2018-3-20_16-42-53.png
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I know this but I need to have a colored edge too
It is important to provide all the information in the first post.

Example of a similar layout created with the designer:

SS-2018-03-20_18.03.51.png


I've used two panels for this where the border is set on the outer panel which is slightly larger.
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
It is important to provide all the information in the first post.

Example of a similar layout created with the designer:

SS-2018-03-20_18.03.51.png


I've used two panels for this where the border is set on the outer panel which is slightly larger.



Thank you for guidance

Is it possible to add to the edges panel with Java code?
Or by reflector code

for exampel

B4X:
Sub SetRadialGradient(GD As GradientDrawable, radius As Float)
    Dim r As Reflector
    r.Target = GD
    r.RunMethod2("setGradientType", 1, "java.lang.int")
    r.RunMethod2("setGradientRadius", radius, "java.lang.float")
End Sub
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I've used two panels
Me too :(

B4X:
    Dim BorderSize As Int = 10dip
    pnlBack.Initialize("")
    Activity.AddView(pnlBack, 0, 0, 200dip + BorderSize * 2, 200dip + BorderSize * 2)
    Dim cd As ColorDrawable
    cd.Initialize(Colors.White, 10dip)
    pnlBack.Background = cd
    
    Dim gdb As GradientDrawable
    Dim GradColors(3) As Int = Array As Int(Colors.red, Colors.Yellow , Colors.Blue)
    gdb.Initialize("TOP_BOTTOM", GradColors)
    gdb.CornerRadius = 10dip
    
    pnlFore.Initialize("")
    Activity.AddView(pnlFore, BorderSize, BorderSize, 200dip, 200dip)
    pnlFore.Background = gdb


(you can easily create a custom view)
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
Me too :(

B4X:
    Dim BorderSize As Int = 10dip
    pnlBack.Initialize("")
    Activity.AddView(pnlBack, 0, 0, 200dip + BorderSize * 2, 200dip + BorderSize * 2)
    Dim cd As ColorDrawable
    cd.Initialize(Colors.White, 10dip)
    pnlBack.Background = cd
   
    Dim gdb As GradientDrawable
    Dim GradColors(3) As Int = Array As Int(Colors.red, Colors.Yellow , Colors.Blue)
    gdb.Initialize("TOP_BOTTOM", GradColors)
    gdb.CornerRadius = 10dip
   
    pnlFore.Initialize("")
    Activity.AddView(pnlFore, BorderSize, BorderSize, 200dip, 200dip)
    pnlFore.Background = gdb


(you can easily create a custom view)
It is important to provide all the information in the first post.

Example of a similar layout created with the designer:

SS-2018-03-20_18.03.51.png


I've used two panels for this where the border is set on the outer panel which is slightly larger.


hi LucaMs

how to use the custom view? "(you can easily create a custom view)" ?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Upvote 0
Top