Java Question Round ListView, 3D ListView and UnBound Listview

walterf25

Expert
Licensed User
Longtime User
Hello fellow developers, i was wondering if anyone would like to give a shot at wrapping up some libraries i found on the internet, you guys can look at them here.
The library i'm most interested in is the Round List View library, I'm not that good in Java just yet so i won't even try to do it myself, maybe someone in here would like to give this a try.

Here's is the source code in Eclipse along with a sample, If anyone is interested in wrapping this up for Basic4Android that would be really awesome, or if someone can give me some tips on how to doit myself i might be willing to give it a try, i've done libraries for a few Ad network companies but this is i think a little too advanced for me.

Here are the source code files in Eclipse

View attachment RoundedListViewSample.zip

Cheers,
Walter Flores
 

thedesolatesoul

Expert
Licensed User
Longtime User
Not wanting to discourage you, but is there a reason you want to avoid B4A classes and wrap this library?
If you use a listview adapter, there is no way you can avoid xml layouts and I am sure you dont want to create an xml layout each time you use the listview?
Also, there is no way to make it generic. Each time you will have to change the listview wrapper to customize it for a particular use case.

These are the problems I was having: http://www.b4x.com/forum/libraries-...ibrary-help-required-expandable-listview.html

Here is another useful thread: http://www.b4x.com/forum/basic4android-getting-started-tutorials/17708-custom-listview-library.html
 

walterf25

Expert
Licensed User
Longtime User
Round List View

Hi there thedesolatesoul, thanks for the reply, the reason i want to use this library instead of B4A classes is because i like the way the listview looks with the round corners, and i'm not really that good with classes anyway.
I actually tried giving this a shot and i'm actually able to add the roundlistview to an activity now on Basic4Android, the problem i'm having is when i try to add an item to the listview i get an error, as i mentioned on my previous post i'm not that good in Java yet, I did follow the link before you posted and tried wrapping up this library that way

http://www.b4x.com/forum/basic...w-library.html

here is a screenshot of the roundlistview on my activity as you can see i can get it to display maybe i can get some help creating the xml layout file.

Cheers,
Walter
 

Attachments

  • round ListView scrnshot.png
    round ListView scrnshot.png
    95.1 KB · Views: 744

NJDude

Expert
Licensed User
Longtime User
If you just want just want to display a ListView with rounded corners, why you need a library when you can CHEAT? :D

Use a transparent PNG, (check the attached sample) just an idea.
 

Attachments

  • Sample.zip
    10.7 KB · Views: 445

walterf25

Expert
Licensed User
Longtime User
Round List View

Hey NJDude, thanks for the idea, actually i found another way to do it, i had no idea we could get round corners on mostly any views with the code below.

I was chasing my own tail, lol.

Thanks all for the help.

B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
'Dim rndlist As RoundListView
Dim rndlist As ListView
Dim cd As ColorDrawable
Dim label1, label2 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("main")
rndlist.Initialize("RoundListView")
Activity.AddView(rndlist, 5%x, 3%y, 90%x, 95%y)

 
cd.Initialize(Colors.ARGB(200, 139,136,120), 20dip)
rndlist.Background = cd
label1 = rndlist.TwoLinesLayout.Label
label2 = rndlist.TwoLinesLayout.SecondLabel
label1.TextColor = Colors.Red
label2.TextColor = Colors.Black
label1.Gravity = Gravity.CENTER_HORIZONTAL
label2.Gravity = Gravity.CENTER_HORIZONTAL
rndlist.ScrollingBackgroundColor = Colors.Transparent
For ii = 0 To 10
rndlist.AddTwoLines2("Round Corners", "Example for Round corners", Null)
Next

Dim r1 As Reflector
                If r1.GetStaticField("android.os.Build$VERSION", "SDK_INT") >= 10 Then
                 r1.Target = rndlist
                 r1.RunMethod4("setOverscrollFooter", Array As Object(Null), _
                  Array As String("android.graphics.drawable.Drawable"))
                End If

End Sub

Since my phone is a motorola Photon, the round corners will not work unless you add the Reflector code shown.

check out a screenshot
roundlistview scrshot.jpg

thanks all!
 

Beja

Expert
Licensed User
Longtime User
Since cheating is allowed, how about this?
What I did is just put the listview on a panel with corner radius = 20 and same color as listview.

cheers!
 

Attachments

  • listview1.png
    listview1.png
    41.1 KB · Views: 579
Top