B4A Library TextDrawable V1.0.2

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

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 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,50, Colors.Black,-1,Typeface.MONOSPACE)
End Sub

TextDrawable001.png
 

Attachments

  • libTextDrawableV1.0.zip
    7.2 KB · Views: 353
  • libTextDrawableV1.0.1.zip
    7.2 KB · Views: 335
  • libTextDrawableV1.0.2.zip
    7.2 KB · Views: 476
  • TextDrawableExample.zip
    12.2 KB · Views: 483
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Initialize method to CreateDrawable
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:

incendio

Well-Known Member
Licensed User
Longtime User
Hi,

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

DonManfred

Expert
Licensed User
Longtime 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.
 

barx

Well-Known Member
Licensed User
Longtime 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.
maybe put the source on gitHub and baybe someone could help?
 

DonManfred

Expert
Licensed User
Longtime User
maybe put the source on gitHub and baybe someone could help?
I´ll first try to upload the Library here and maybe someone (look into the round ;)) want to have a look at it :rolleyes:
 

Attachments

  • TextDrawableLibSrc.zip
    25.7 KB · Views: 302

johndb

Active Member
Licensed User
Longtime 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.

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
 
Top