Search code examples
javaandroidandroid-actionbarpreferenceactivity

Preference Screen and nav & status bar translucent


I'm using System Bar Tint to make my status and navigation bars translucent and with the color i want. The github: https://github.com/jgilfelt/SystemBarTint

It's working perfectly! I hace one tiny problem, when the phone turns into landscape or portrait mode. Because of the translucent status and nav, I have to get the layout and add a margin-top when im in portrait mode for example, simulating this way the space the status bar has.

But my problem comes in PreferenceScreen activity. I use:

addPreferencesFromResource(R.xml.preferences);

to create my preferences screen. And i cannot get the way to change the layoutParams.

Does anyone have a solution for this??

Thanks!

enter image description here


Solution

  • A1. Use Theme.
    How to apply theme to PreferenceScreen elements of a PreferenceCategory


    A2.

    ListView listView = getListView();
    

    and set layoutParams to listView.

    PreferenceActivity is a subclass of ListActivity.