B4A Library TextDrawable V1.0.2

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Feb 3, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    This light-weight library provides images with letter/text like the Gmail app. It extends the Drawable

    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 td As TextDrawable
        
    Private Button1 As Button
        
    Private Button2 As Button
        
    Private Button3 As Button
    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("Layout1")
        Button1.Background = td.CreateDrawableRect(
    "B4i",Colors.DarkGray,Colors.Blue,-1,Typeface.MONOSPACE)
        Button2.Background = td.CreateDrawableRound(
    "B4A",Colors.Magenta, Colors.Yellow,-1,Typeface.MONOSPACE)
        Button3.Background = td.CreateDrawableRoundRect(
    "B4J",Colors.Cyan,50Colors.Black,-1,Typeface.MONOSPACE)
    End Sub
    [​IMG]
     

    Attached Files:

    Last edited: Feb 5, 2015
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Is this api21 only?

    Another question, I think you should rename the Initialize method to CreateDrawable as the td object seems to be static.

    Thanks!
     
    NJDude likes this.
  3. DonManfred

    DonManfred Expert Licensed User

    CreateDrawableRect instead of InitializeRect?

    It should work with lower apis too... i used 19 in eclipse... but i changed it to 8 now and works too..

    Will update the lib in a few minutes so you can test it again if you want

    Edit: V1.0.1 uploaded. Can you please check with lower sdk? i think 8 should be enough but i´m not sure ;)
     
    Last edited: Feb 3, 2015
    thedesolatesoul likes this.
  4. NJDude

    NJDude Expert Licensed User

    Also, compile with a current version of B4A, it seems you are using the latest BETA, the warning in the beginning might confuse some users.
     
  5. DonManfred

    DonManfred Expert Licensed User

    sure i am. I only have one installation of b4a. Actually 4.3beta ;-)
     
    lemonisdead and Peter Simpson like this.
  6. Peter Simpson

    Peter Simpson Expert Licensed User

    I just need to figure out which app I can use this in, in any...
     
    DonManfred likes this.
  7. incendio

    incendio Well-Known Member Licensed User

    Hi,

    Thanks for the library, is that possible to set font size and font style(Bold/Italic/Underline) in the Button?
     
  8. DonManfred

    DonManfred Expert Licensed User

    Actually no. But i´ll extend the Library for this...
     
    incendio likes this.
  9. DonManfred

    DonManfred Expert Licensed User

    I´m sorry. I have had a look... Maybe it´s my java-knowledge about Classes... I´m not able to change anything it seems. I can hardcode other values but that´s not what we need.

    I can for sure give the source of this library. If there is someone who can do this.
     
  10. barx

    barx Well-Known Member Licensed User

    maybe put the source on gitHub and baybe someone could help?
     
  11. DonManfred

    DonManfred Expert Licensed User

    I´ll first try to upload the Library here and maybe someone (look into the round ;)) want to have a look at it :rolleyes:
     

    Attached Files:

    thedesolatesoul likes this.
  12. NJDude

    NJDude Expert Licensed User

    I think the way this library is should be fine, after all, these buttons are just to "highlight" something, no need to get too fancy.

    My opinion.
     
  13. johndb

    johndb Active Member Licensed User

    I'm in agreement with you NJDude except for one desired enhancement. It would be helpful to allow for the character color within the TextDrawable to be changed to a color other than white. White text on lighter backgrounds makes it difficult to see the character. If we had a minimum enhancement of either selecting White or Black as the character color that would be great?

    John
     
  14. DonManfred

    DonManfred Expert Licensed User

    i figured it out... New Example and nw lib uploaded to post #1
     
    incendio, johndb and ellpopeb4a like this.
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