Other [new feature] FontAwesome and Material Icons

Discussion in 'Android Questions' started by Erel, Nov 30, 2016.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    Last edited: Nov 30, 2016
  2. MarcoRome

    MarcoRome Expert Licensed User

    This is really fantastic :D:D
     
  3. MarcoRome

    MarcoRome Expert Licensed User

    When will be ready the next Rel B4A ?
     
  4. MarcoRome

    MarcoRome Expert Licensed User

  5. Erel

    Erel Administrator Staff Member Licensed User

    The beta version is almost ready.

    Yes. The icons are regular characters. The picker just copies them to the clipboard.
    See the tips section at the end of the tutorial.
     
    MarcoRome likes this.
  6. tpakis

    tpakis Active Member Licensed User

    Like!!
     
  7. so27

    so27 Active Member Licensed User

    I like it!
     
  8. corwin42

    corwin42 Expert Licensed User

    Will it be possible to create Drawables on the fly from the IconFonts so we can use them for ActionItems in the Menu or in the NavigationView (DesignSupport lib) ?
     
    DonManfred likes this.
  9. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    The icons are regular characters. It is possible to convert them to drawables with:
    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
    Activity.AddMenuItem3("Apple""Test", TextToBitmap(Chr(0xF179), 28), True)
       
    Activity.AddMenuItem3("Android""Test", TextToBitmap(Chr(0xF17B), 28), True)
    End Sub

    Sub TextToBitmap (s As String, FontSize As Float) As Bitmap
       
    Dim bmp As Bitmap
       bmp.InitializeMutable(
    32dip32dip)
       
    Dim cvs As Canvas
       cvs.Initialize2(bmp)
       
    Dim h As Double = cvs.MeasureStringHeight(s, lblfontAwesome.Typeface, FontSize)
       cvs.DrawText(s, bmp.Width / 
    2, bmp.Height / 2 + h / 2, lblfontAwesome.Typeface, FontSize, Colors.White, "CENTER")
       
    Return bmp
    End Sub
    Note that the Chr(0xxxx) comes from the code editor icon picker.
     
  10. MarcoRome

    MarcoRome Expert Licensed User

    Sorry Erel maybe i dont understand. But where can i see this Code Chr(0xxx), because if i select i copy "pictures", but dont see code.
    Where i wrong ?
    Thank you
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Open the code editor icon picker:

    [​IMG]
     
    MarcoRome likes this.
  12. chefe82

    chefe82 Member Licensed User

    Hello,


    With B4A 6.50 I do not have the menu point.

    Unbenannt.PNG

    What could be the reason?
     
  13. DonManfred

    DonManfred Expert Licensed User

    No one said it is a menuentry...

    Right click in the editorwindow and in the context-sensitive popup you´ll find the picker.
     
  14. Sapta

    Sapta Member Licensed User


    Hi @Erel
    According this code, I use in Icon but error
    Code:
    NavDrawer.NavigationView.Menu.AddWithGroup2(231000"Setting", XML.GetDrawable("ic_settings_black_24dp"))
    to ..
    Code:
    NavDrawer.NavigationView.Menu.AddWithGroup2(231000"Setting", TextToBitmap(Chr(0xF179), 28))
    got error : java.lang.IllegalArgumentException: method de.amberhome.objects.appcompat.ACMenuWrapper.AddWithGroup2 argument 5 has type android.graphics.drawable.Drawable, got android.graphics.Bitmap

    What this mean?
    Thank you
     
  15. Emme Developer

    Emme Developer Well-Known Member Licensed User

    TextToBitmap return a bitmap, AddWithGroup2 Expect a Drawable

    Code:
    Dim bd As BitmapDrawable
        bd.Initialize(TextToBitmap(
    Chr(0xF179), 28))
        NavDrawer.NavigationView.Menu.AddWithGroup2(
    231000"Setting", bd)
     
    Sapta, MarcoRome and DonManfred like this.
  16. Erel

    Erel Administrator Staff Member Licensed User

    You should always start a new thread for your questions.
     
Thread Status:
Not open for further replies.
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