美文网首页
fragment注入

fragment注入

作者: 勤学奋进小郎君 | 来源:发表于2018-09-04 16:37 被阅读0次

原理

PreferenceActivity类中有一个静态变量 EXTRA_SHOW_FRAGMENT

    /**
     * When starting this activity, the invoking Intent can contain this extra
     * string to specify which fragment should be initially displayed.
     * <p/>Starting from Key Lime Pie, when this argument is passed in, the PreferenceActivity
     * will call isValidFragment() to confirm that the fragment class name is valid for this
     * activity.
     */
大意:开启acitivity活动时,可以通过intent包含额外的数据(类型:EXTRA_SHOW_FRAGMENT)来指定最开始展示的fragment
    public static final String EXTRA_SHOW_FRAGMENT = ":android:show_fragment";

相关文章

网友评论

      本文标题:fragment注入

      本文链接:https://www.haomeiwen.com/subject/arxnwftx.html