当前位置: 首页>>代码示例>>Java>>正文


Java LayoutInflaterCompat.setFactory方法代码示例

本文整理汇总了Java中android.support.v4.view.LayoutInflaterCompat.setFactory方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutInflaterCompat.setFactory方法的具体用法?Java LayoutInflaterCompat.setFactory怎么用?Java LayoutInflaterCompat.setFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.LayoutInflaterCompat的用法示例。


在下文中一共展示了LayoutInflaterCompat.setFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createView

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
/**
 * Creates the view for the given fragment. This will trigger {@link
 * me.tatarka.simplefragment.SimpleFragment#onCreateView(LayoutInflater, ViewGroup)}
 * immediately. This will <em>not</em> occur automatically on configuration changes, you are
 * responsible for calling it again in those cases.
 *
 * @param fragment The {@code SimpleFragment} to createView.
 * @throws java.lang.IllegalArgumentException If the given fragment is null or was not added to
 *                                            this manager.
 */
public View createView(SimpleFragment fragment, LayoutInflater layoutInflater, @Nullable ViewGroup parentView) {
    if (fragment == null) {
        throw new IllegalArgumentException("SimpleFragment cannot be null.");
    }
    if (!fragments.contains(fragment)) {
        throw new IllegalArgumentException("Attempting to createView fragment that was not added: '" + fragment + "'");
    }

    if (fragment.getView() != null) {
        throw new IllegalArgumentException("Attempting to createView fragment that has already been attached.");
    }

    // To support <fragment> tags in nested layouts, we need a custom inflater.
    LayoutInflater fragmentInflater = layoutInflater.cloneInContext(activity);
    LayoutInflaterCompat.setFactory(fragmentInflater, new SimpleFragmentViewInflater(fragment.getSimpleFragmentManager()));

    return fragment.createView(fragmentInflater, parentView);
}
 
开发者ID:evant,项目名称:simplefragment,代码行数:29,代码来源:SimpleFragmentStateManager.java

示例2: setCustomTheme

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
public static void setCustomTheme(Context context, SparseIntArray customAttrs) {
    if (customAttrs == null || customAttrs.size() == 0) {
        currentAttrs = null;
        return;
    }
    
    TypedValue tmp = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.textColorPrimary, tmp, true);
    int textColorPrimaryOriginal = (tmp.type >= TypedValue.TYPE_FIRST_COLOR_INT && tmp.type <= TypedValue.TYPE_LAST_COLOR_INT) ?
            tmp.data : Color.TRANSPARENT;
    int textColorPrimaryOverridden = customAttrs.get(android.R.attr.textColorPrimary, textColorPrimaryOriginal);
    
    try {
        processWindow(context, customAttrs, textColorPrimaryOriginal, textColorPrimaryOverridden);
    } catch (Exception e) {
        Logger.e(TAG, e);
    }
    
    CustomThemeHelper instance = new CustomThemeHelper(context, customAttrs, textColorPrimaryOriginal, textColorPrimaryOverridden);
    LayoutInflaterCompat.setFactory(instance.inflater, instance);
    currentAttrs = customAttrs;
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:23,代码来源:CustomThemeHelper.java

示例3: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    if (needAnimator()) {
        AnimatorManager.setConfig(new AnimatorConfig.Builder()
                .textviewVisibleAnimationType(ViewAnimatorType.AlphaHideAnimator)
                .textviewTextAnimationType(ViewAnimatorType.AlphaUpdateAnimator)
                .imageviewVisibleAnimationType(ViewAnimatorType.AlphaHideAnimator)
                .build());
    }
    LayoutInflaterCompat.setFactory(getLayoutInflater(), getSkinDelegate());
    super.onCreate(savedInstanceState);
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:13,代码来源:SkinCompatActivity.java

示例4: installViewFactory

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
public void installViewFactory() {
    LayoutInflater layoutInflater = LayoutInflater.from(this.mContext);
    if (layoutInflater.getFactory() == null) {
        LayoutInflaterCompat.setFactory(layoutInflater, this);
    } else if (!(LayoutInflaterCompat.getFactory(layoutInflater) instanceof AppCompatDelegateImplV7)) {
        Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:AppCompatDelegateImplV7.java

示例5: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
    protected final void onCreate(@Nullable Bundle savedInstanceState) {
        // define the IconicsLayoutInflater
        // this is compatible with calligraphy and other libs which wrap the baseContext
        LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
        super.onCreate(savedInstanceState);

        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setHomeButtonEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
        }

        mActivity = this;
        mApplication = (PTApplication) getApplication();
        mBundle = getIntent().getExtras() != null ? getIntent().getExtras() : new Bundle();
        unbinder = ButterKnife.bind(this);
        mLoadingView = new LoadingView(this, getLoadingMessage());
//        loadState = (ILoadState) findViewById(R.id.load_state_view);
//        mPTLoading = new PTLoading.Builder(this)
//                .setCanceledOnTouchOutside(false)
//                .setIcon(R.drawable.button_loading_icon)
//                .setMsg(getString(R.string.loading_data))
//                .build();
//        mPTToast = new PTToast.Builder(this)
//                .setShowTime(1300)
//                .build();
        if (useEventBus())
            EventBusUtils.register(this);
        onViewCreated(savedInstanceState);
    }
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:32,代码来源:PTActivity.java

示例6: installLayoutFactory

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
private void installLayoutFactory(Context context) {
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    try {
        Field field = LayoutInflater.class.getDeclaredField("mFactorySet");
        field.setAccessible(true);
        field.setBoolean(layoutInflater, false);
        LayoutInflaterCompat.setFactory(layoutInflater, getSkinDelegate(context));
    } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:12,代码来源:SkinActivityLifecycle.java

示例7: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    LayoutInflaterCompat.setFactory(getLayoutInflater(), getSkinDelegate());
    super.onCreate(savedInstanceState);
    updateStatusBarColor();
    updateWindowBackground();
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:8,代码来源:SkinCompatActivity.java

示例8: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    skinFactory = new SkinFactory(ApkSkin.path);
    LayoutInflaterCompat.setFactory(getLayoutInflater(), skinFactory);

}
 
开发者ID:XaskYSab,项目名称:CSkin,代码行数:8,代码来源:BaseSkinActivity.java

示例9: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    //在setContentView之前设置好工厂
    LayoutInflater layoutInflater = LayoutInflater.from(this);
    LayoutInflaterCompat.setFactory(layoutInflater, this);
    SkinManager.getInstance().init(this);
    /*if (layoutInflater.getFactory() == null) {
        LayoutInflaterCompat.setFactory(layoutInflater, this);
    }*/
    super.onCreate(savedInstanceState);
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:12,代码来源:BaseSkinActivity.java

示例10: attach

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
/**
 * this method should be called in Activity onCreate method,
 * and before method super.onCreate(savedInstanceState);
 *
 * @param activity
 */
public void attach(AppCompatActivity activity) {

    if (activity.getDelegate() instanceof LayoutInflaterFactory) {
        LayoutInflaterFactory originInflaterFactory = (LayoutInflaterFactory) activity.getDelegate();
        LayoutInflaterFactory proxyInflaterFactory = (LayoutInflaterFactory) Proxy.newProxyInstance(
                originInflaterFactory.getClass().getClassLoader(),
                new Class[]{LayoutInflaterFactory.class},
                new InflaterHandler(originInflaterFactory, activity));

        LayoutInflater layoutInflater = LayoutInflater.from(activity);
        LayoutInflaterCompat.setFactory(layoutInflater, proxyInflaterFactory);
    }
}
 
开发者ID:wlt2017,项目名称:zhizhihuhu,代码行数:20,代码来源:NightModelManager.java

示例11: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bindView();
    initView();
    setupComponent();
}
 
开发者ID:akexorcist,项目名称:Droid2JoyStick,代码行数:11,代码来源:MainActivity.java

示例12: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
    super.onCreate(savedInstanceState);
    ThemeUtil.setCustomTheme(this);
    LanguageUtil.updateLanguage(this);
    tintBars();
}
 
开发者ID:adrielcafe,项目名称:NMSAlphabetAndroidApp,代码行数:9,代码来源:BaseActivity.java

示例13: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    // define the IconicsLayoutInflater
    // this is compatible with calligraphy and other libs which wrap the baseContext
    LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));

    super.onCreate(savedInstanceState);
}
 
开发者ID:mingjunli,项目名称:GithubApp,代码行数:9,代码来源:BaseActivity.java

示例14: ReplaceSystemControls

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
public void ReplaceSystemControls() {
        LayoutInflaterCompat.setFactory(LayoutInflater.from(this), new LayoutInflaterFactory() {
            @Override
            public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
//                /**
//                 * 可以在这里将系统类替换为自定义View,不要在这里做处理,到相应的类中复写该方法
//                 */
//                if (name.equals("ImageView")) {
//                    return new Button(context, attrs);
//                }
                return getDelegate().createView(parent, name, context, attrs);
            }
        });
    }
 
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:15,代码来源:BaseActivity.java

示例15: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    mSkinInflaterFactory = new SkinInflaterFactory();
    LayoutInflaterCompat.setFactory(getLayoutInflater(), mSkinInflaterFactory);
    super.onCreate(savedInstanceState);
    changeStatusColor();
    setContentView(layoutResoursId());
}
 
开发者ID:XinRan5312,项目名称:QxChangeThemeSkin,代码行数:9,代码来源:QxSkinBaseActivity.java


注:本文中的android.support.v4.view.LayoutInflaterCompat.setFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。