B4A Class SLSPinner - Android 4 style spinner for all API's

Discussion in 'Additional libraries, classes and official updates' started by stevel05, Jan 22, 2014.

  1. stevel05

    stevel05 Expert Licensed User

    No I hadn't thought about that, if the parent is a scroll view, it's position will have to be recalculated each time it's accessed.
     
  2. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, Steve, for this and all of your contributions to the forum.

    The SLSPinner contains some of the attributes which should be part of the V4 Standard Spinner. It is simply just a better spinner.

    For those who do not have a device with an pre 4 Android version, you can simulate the "standard spinner" behavior by adding this line to the manifest:

    Code:
    SetActivityAttribute(main, android:theme, "@android:style/Theme.Translucent")
    I came to this discovery, not by brilliant wisdom, but merely by chance since I ran into the issue of a spinner reverting back to "pre Android 4" when I added this line to the Manifest Editor.

    I created a new thread related to a question on the behavior of other views when Theme.Traslucent is used:

    http://www.basic4ppc.com/android/fo...t-theme-affects-behavior-of-some-views.44932/

    Best regards.

    Sandy
     
    Last edited: Sep 21, 2014
  3. bluedude

    bluedude Well-Known Member Licensed User

    Pretty cool but gravity right is not working properly, items are almost not visible.
     
  4. stevel05

    stevel05 Expert Licensed User

    Hi BlueDude,

    The border was covering part of the listview item, try the attached.
     

    Attached Files:

  5. bluedude

    bluedude Well-Known Member Licensed User

    Good start but not completely, see attached screen for two issues. When gravity is right the selected value is too much to the right (on top of the selection triangle). Second, when the dropdown is generated gravity is center.

    Where exactly can I fix this in the code? Maybe some padding on top of gravity would be flexible.

    One other thing I was wondering is how to set the border the same as the background of the list.
     

    Attached Files:

  6. stevel05

    stevel05 Expert Licensed User

    With this version I've added a ButtonPadding(Left,Top,Right,Bottom) Method, so you can set the padding as you want it. You will need to do a Bit.Or on the Gravity, Bit.Or(Gravity.Right,Gravity.Center_Vertical) or it will set gravity to Right Top by default.

    You can change the border color using the ListBorderColor method.
     

    Attached Files:

  7. bluedude

    bluedude Well-Known Member Licensed User

    The padding is cool and a solution but my problem is the gravity in the dropdown, see attached picture. It also needs to put values at the right. Not sure why it displays some pixels from the left when the width becomes bigger.
     

    Attached Files:

  8. stevel05

    stevel05 Expert Licensed User

    Hi bluedude, it's a while since I've looked at this I have to go out this evening, so I'll take a better look tomorrow.
     
  9. stevel05

    stevel05 Expert Licensed User

    OK, try this one. The reason was that the label width in the list was not being adjusted, it should work now. I've also put 20Dip right padding in as default which you can still change if needed.
     

    Attached Files:

  10. bluedude

    bluedude Well-Known Member Licensed User

    Hi, that works great! One other question. I want to adapt the backcolor, border automatically to the Android OS it runs on. Just like the default spinner.

    Any suggestions?
     
  11. bluedude

    bluedude Well-Known Member Licensed User

    Hi, also setting the listborder smaller will kill gravity settings in dropdown.

    Backcolor adaption works BTW.
     
  12. bluedude

    bluedude Well-Known Member Licensed User

    One very tiny styling thing. Can the dropdown text be right gravity with some kind of offset? When there is a scollbar the scrollbar is over the text, would like do have the text slightly more to the left (padding or offset).

    Would like to know how to change it myself.
     
  13. stevel05

    stevel05 Expert Licensed User

    Hi Bluedude,

    The attached fixes the first issue, changing the border width reset the width of the label, (see Sub setListBorderSize) I have changed this to use the current size.

    The default padding is set in Sub SetUpButton, you can change the value (currently 20) as you like.

    When you're happy with this, I'll upload it to the first post.

    Thanks

    Steve
     

    Attached Files:

  14. bluedude

    bluedude Well-Known Member Licensed User

    Hi, the issue I'm talking about is the problem in the dropdown where all the values show. Gravity right works but the values are really tight to the right edge, it does not look too good especially when there is a scroll feature.

    The padding is not working in the list.
     
  15. stevel05

    stevel05 Expert Licensed User

    OK, I'm with you. I thought it would be as simple as adding padding to the SPList.SingleLineLayout.Label, but that's causing a ClassCastException. I'm out for the rest of the day, I'll try and take a look tomorrow.
     
  16. johndb

    johndb Active Member Licensed User

    Is Spinner5.zip the latest or has the first post been updated with the latest revisions?
    Has the issue related to placing the spinner on a scrollview been resolved?
     
    Last edited: Jan 22, 2015
  17. stevel05

    stevel05 Expert Licensed User

    Hi John,

    Spinner5 is the latest version, this issue was not completed. If it causes you any problems I'll add it to my current list and revisit it when I get a chance.

    Steve
     
  18. ArminKH

    ArminKH Well-Known Member

    Hi stevel
    Thank u 4 sharing this usefull class
    What is the difference between normal version and pre version?
    The difference is in android version or basic version?
    I use normal version now,thats okay in all android version?
    Tnx again
     
  19. stevel05

    stevel05 Expert Licensed User

    There is no functional difference, just the code syntax is slightly different for the Pre 3.2 version.
     
    ArminKH likes this.
  20. ArminKH

    ArminKH Well-Known Member

    Ok tnx
    But which version we can use?the first post link is updated?because i have same issue with right edge padding with persian and arabic language(right to left)
    Now we must download your lib from first post or download slspinner5 ?
     
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