Share My Creation Demo: Expandable Panels

Attachments

  • backupsms.png
    backupsms.png
    43.9 KB · Views: 6,416
Last edited:

bluedude

Well-Known Member
Licensed User
Longtime User
Can you share the source of this demo?

I like the style of this one, can you share the source code?

Cheers.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Nothing special, just wondering how you did these nicely styles panels

Just wondering how you did these panels with shadows etc.
 

thedesolatesoul

Expert
Licensed User
Longtime User
Just wondering how you did these panels with shadows etc.
Ah those are just 9patch pngs. I suck at graphics so spent a week finding ones I like. I wanted it to be like google cards, but those were not as nice as these ones. Cant remember where I got them from, I can send them to you when i get home. They are however a little annoying since they require you to do everything at an offset.
 

bluedude

Well-Known Member
Licensed User
Longtime User
My problem too these graphics, that's why I ask :)

So are these stretching when panel expands etc.?
 

thedesolatesoul

Expert
Licensed User
Longtime User
My problem too these graphics, that's why I ask :)

So are these stretching when panel expands etc.?
Yes, they automatically expand.
With a 9patch you define the borders, and the content area. It is just like a regular png file, but with a 1 pixel border on each side. Within that you define the stretchable area.
So the borders do not expand, but the region in the centre can expand, so it still looks good.
 

bluedude

Well-Known Member
Licensed User
Longtime User
How did you implement these for the expandable panels? Is it a background?

Cheers,
 

thedesolatesoul

Expert
Licensed User
Longtime User

bluedude

Well-Known Member
Licensed User
Longtime User
thedesolatesoul

Tried the ninepatch tutorial (label) with your background but actually does not work at all.

Any code to share how you did this with the expanding panels?

Cheers,
 

thedesolatesoul

Expert
Licensed User
Longtime User
What do you mean by does not work at all?

Here is the code I used:

UIBuilder is a code module:
B4X:
   UIBuilder.SetNinePatchView(pnlSchedule.AsPanel ,"search_bg_shadow")

This code sets the 9patch to any view:
B4X:
Sub SetNinePatchView(lbl As View, DefaultImage As String)
    Dim R As Reflector
    Dim package As String
    Dim idDefault, idPressed, idSelected As Int
    package = R.GetStaticField("anywheresoftware.b4a.BA", "packageName")
    idDefault  = R.GetStaticField(package & ".R$drawable", DefaultImage)
    R.Target   = R.GetContext
    R.Target   = R.RunMethod("getResources")

   lbl.Background  = R.RunMethod2("getDrawable", idDefault, "java.lang.int")
   
End Sub
 

lock255

Well-Known Member
Licensed User
Longtime User
For a beginner like me, it would be very interesting to see the full source code :)
 

thedesolatesoul

Expert
Licensed User
Longtime User
Top