Java Question Round ListView, 3D ListView and UnBound Listview

Discussion in 'Libraries developers questions' started by walterf25, Dec 17, 2012.

  1. walterf25

    walterf25 Well-Known Member Licensed 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
     
  2. thedesolatesoul

    thedesolatesoul Expert Licensed 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.basic4ppc.com/forum/libr...ibrary-help-required-expandable-listview.html

    Here is another useful thread: http://www.basic4ppc.com/forum/basi...-tutorials/17708-custom-listview-library.html
     
  3. walterf25

    walterf25 Well-Known Member Licensed 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.basic4ppc.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
     

    Attached Files:

  4. NJDude

    NJDude Expert Licensed 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.
     

    Attached Files:

  5. walterf25

    walterf25 Well-Known Member Licensed 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.

    Code:
    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%x3%y90%x95%y)

     
    cd.Initialize(
    Colors.ARGB(200139,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!
     
  6. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Well, that was a lot easier than going down the hard route!
     
  7. Beja

    Beja Expert Licensed 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!
     

    Attached Files:

  8. Erel

    Erel Administrator Staff Member Licensed User

    Guys this is not the place for this fight. This is a public, technical forum.

    Messages removed...
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice