PreferenceManager.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:MaterialPreference 作者:
/**
 * Inflates a preference hierarchy from XML. If a preference hierarchy is
 * given, the new preference hierarchies will be merged in.
 *
 * @param context The context of the resource.
 * @param resId The resource ID of the XML to inflate.
 * @param rootPreferences Optional existing hierarchy to merge the new
 *            hierarchies into.
 * @return The root hierarchy (if one was not provided, the new hierarchy's
 *         root).
 * @hide
 */
@RestrictTo(LIBRARY_GROUP)
public PreferenceScreen inflateFromResource(Context context, int resId,
                                            PreferenceScreen rootPreferences) {
    // Block commits
    setNoCommit(true);

    final PreferenceInflater inflater = new PreferenceInflater(context, this);
    inflater.setDefaultPackages(getDefaultPackages());
    rootPreferences = (PreferenceScreen) inflater.inflate(resId, rootPreferences);
    rootPreferences.onAttachedToHierarchy(this);

    // Unblock commits
    setNoCommit(false);

    return rootPreferences;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号