Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError when trying to access android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS #278

Closed
chbeltz opened this issue Jun 9, 2017 · 1 comment
Labels

Comments

@chbeltz
Copy link

chbeltz commented Jun 9, 2017

Here is the relevant part of my code:

def set_status_bar_colour(self):
    try:
        # Turn status bar green
        from jnius import autoclass
        from jnius.jnius import JavaException

        #try:
        LayoutParams = autoclass('android.view.WindowManager$LayoutParams')
        R = autoclass('android.R')
        activity = autoclass('org.kivy.android.PythonActivity').mActivity

        window = activity.getWindow()
        LayoutParams = window.getAttributes()
        window.clearFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS)
        window.addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        window.setStatusBarColor(activity.getResources().getColor(R.color.holo_green_light))

       #except JavaException as ex:
            # Insufficient SDK version
            #pass

    except ImportError:
        # Not on Android
        pass

The full error I get is AttributeError: 'android.view.WindowManager$LayoutParams' object has no attribute 'FLAG_TRANSLUCENT_STATUS'. The relevant part of the adb logcat output can be found here.

If anyone is wondering why I'm using autoclass('android.view.WindowManager$LayoutParams') as opposed to autoclass('android.view.WindowManager.LayoutParams'): The second verison would also give me an AttributeError.

Any help is appreciated!


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@github-actions
Copy link

👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants