B4A Library VectorDrawables

This is a small wrap to make the VectorDrawables from this github project available in b4a.
1676 Vectordrawables you´ll find there. With help of this library you can use any of them in any color you like.

VectorDrawables
Author:
DonManfred (wrapper)
Version: 1
  • VectorDrawable
    Methods:
    • Initialize (Resource As String)
    • IsInitialized As Boolean
    Properties:
    • Alpha As Int [write only]
    • AutoMirrored As Boolean [write only]
    • ColorFilter As Int [write only]
    • Current As Drawable [read only]
    • Dither As Boolean [write only]
    • tint As Int [write only]



Setup:
- Download VectorDrawablesV1.0.zip and extract the files to your additional libraries folder.
- Download the Example and extract it.
- Go to https://github.com/MrBIMC/MaterialDesignIcons
and download the package there. Extract the package. Take the RES folder from your extracted files and copy it to the Example projectdir.
Rename the folder Res to Resources (as i used the foldername Resources in my examplecode)

Run the example.

B4X:
#AdditionalRes: ..\Resources

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim vd As VectorDrawable
    Private ImageView1 As ImageView
    Private ImageView2 As ImageView
    Private ImageView3 As ImageView
    Private ImageView4 As ImageView
    Private ImageView5 As ImageView
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")
    vd.Initialize("zzz_account_key")
    vd.ColorFilter = Colors.Red
    vd.Alpha = 255
    ImageView1.Background = vd.Current

    vd.Initialize("zzz_youtube")
    vd.ColorFilter = Colors.Blue
    vd.Alpha = 255
    ImageView2.Background = vd.Current

    vd.Initialize("zzz_android_debug_bridge")
    vd.ColorFilter = Colors.Magenta
    vd.Alpha = 255
    ImageView3.Background = vd.Current

    vd.Initialize("zzz_github_box")
    vd.ColorFilter = Colors.Red
    vd.Alpha = 255
    ImageView4.Background = vd.Current

    vd.Initialize("zzz_youtube")
    vd.ColorFilter = Colors.Red
    vd.Alpha = 255
    ImageView5.Background = vd.Current
End Sub

Screenshot_20160710-104343.png
 

Attachments

  • VectorDrawablesEx.zip
    7.7 KB · Views: 224
  • VectorDrawablesV1.0.zip
    2 KB · Views: 240
Last edited:
Top