Android Question [SOLVED] Change StatusBar icon color

Discussion in 'Android Questions' started by Emme Developer, Feb 18, 2018.

  1. Emme Developer

    Emme Developer Well-Known Member Licensed User

    Is possible to change programmatically the color of icons in status bar?
    I know it's possible to change it from theme, but i need to change it at Runtime.
    I this way i change the color of status bar:

    Code:
    Sub SetStatusBarColor(clr As Int)
        
    Dim p As Phone
        
    If p.SdkVersion > 20 Then
            
    Dim jo As JavaObject
            jo.InitializeContext
            
    Dim window As JavaObject = jo.RunMethodJO("getWindow"Null)
            window.RunMethod(
    "addFlags"Array (0x80000000))
            window.RunMethod(
    "clearFlags"Array (0x04000000))
            window.RunMethod(
    "setStatusBarColor"Array(clr))
        
    End If
    End Sub
    Thanks
     
  2. DonManfred

    DonManfred Expert Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    Which icons are you asking about?
     
  4. Emme Developer

    Emme Developer Well-Known Member Licensed User

    Icons of signal, battery, hours text etc


    Thanks for answer, i know this, but this requires activity restart. I actually change the color of status bar without close the activity, and i need to do the same with text and icon color
     
  5. Emme Developer

    Emme Developer Well-Known Member Licensed User

    Last edited: Feb 19, 2018
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