I have created preference-headers.xml. I want to set header icon via ?attr, but it doesn't show the icon.
<?xml version="1.0" encoding="utf-8"?>
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >
<header
    android:fragment="com.armsoft.mtrade.activities.PreferencesActivity$PrefsAboutFragment"
    android:icon="?attr/menuIconAbout"
    android:title="@string/about" />
</preference-headers>
                I solved the problem with a mixture of headers.xml and Changing the icon.
public void onBuildHeaders(List<Header> target) {
    this.loadHeadersFromResource(R.xml.pref_headers, target);
    // search for the current header by comparing the titelRes Ids
    for (Header header : target) {
        if (header.titleRes == R.string.pref_style_title) {
            int themeDependIcon = ... //load the needed icon
            header.iconRes = themeDependIcon ;
            break;
    }
    }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With