且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法通过?attr设置标题首选项图标

更新时间:2023-12-03 21:09:22

我解决了混合headers.xml和更改图标的问题.

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;
    }
    }
}