Share My Creation Demo: Expandable Panels

Attachments

  • backupsms.png
    backupsms.png
    43.9 KB · Views: 7,157
Last edited:
Can you share the source of this demo?

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

Cheers.
 
Nothing special, just wondering how you did these nicely styles panels

Just wondering how you did these panels with shadows etc.
 
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.
 
My problem too these graphics, that's why I ask :-)

So are these stretching when panel expands etc.?
 
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.
 
How did you implement these for the expandable panels? Is it a background?

Cheers,
 
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,
 
What do you mean by does not work at all?

Here is the code I used:

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

This code sets the 9patch to any view:
Code: Copy
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
 
For a beginner like me, it would be very interesting to see the full source code :)
 
Back
Top