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


Java LayoutInflaterCompat类代码示例

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


LayoutInflaterCompat类属于android.support.v4.view包,在下文中一共展示了LayoutInflaterCompat类的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: installPandroidViewFactory

import android.support.v4.view.LayoutInflaterCompat; //导入依赖的package包/类
public static void installPandroidViewFactory(AppCompatActivity compatActivity) {
    List<LayoutInflater.Factory2> factories = new ArrayList<>();
    if (compatActivity instanceof PandroidFactoryProvider) {
        addProviderFactories((PandroidFactoryProvider) compatActivity, factories);
    }
    if (compatActivity.getApplication() instanceof PandroidFactoryProvider) {
        addProviderFactories((PandroidFactoryProvider) compatActivity.getApplication(), factories);
    }
    if (!factories.isEmpty()) {
        LayoutInflater inflater = LayoutInflater.from(compatActivity);
        if (inflater.getFactory2() == null) {
            PandroidViewFactory factory = new PandroidViewFactory(compatActivity.getDelegate(), factories);
            LayoutInflaterCompat.setFactory2(inflater, factory);
        } else {
            LogcatLogger.getInstance().w(TAG, "can't set layout inflater factory");
        }
    } else {
        LogcatLogger.getInstance().w(TAG, "Your activity or application should implement PandroidFactoryProvider to install PandroidLayoutInflaterFactory");
    }

}
 
开发者ID:MobileTribe,项目名称:pandroid,代码行数:22,代码来源:PandroidViewFactory.java

示例3: 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

示例4: 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

示例5: hookLayoutInflater

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

示例6: onCreate

import android.support.v4.view.LayoutInflaterCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    LayoutInflaterCompat.setFactory2(getLayoutInflater(), new ThemedViewFactory(this));
    mCurrentPrimaryColor = ThemeHelper.getPrimaryColor(this);
    mCurrentAccentColor = ThemeHelper.getAccentColor(this);
    super.onCreate(savedInstanceState);
    applyStatusBarColor();
    if (ThemeHelper.hasCustomPrimaryColor(this) &&
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setTaskDescription(new ActivityManager.TaskDescription(null, null,
                mCurrentPrimaryColor));
    }
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:14,代码来源:ThemedActivity.java

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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