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


Java LayoutInflaterFactory类代码示例

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


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

示例1: attach

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的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

示例2: ReplaceSystemControls

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的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

示例3: installViewFactory

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
public void installViewFactory(@Nullable LayoutInflaterFactory delegateFactory) {
    this.delegateFactory = delegateFactory;
    LayoutInflater layoutInflater = LayoutInflater.from(activity);
    if (layoutInflater.getFactory() == null) {
        LayoutInflaterCompat.setFactory(layoutInflater, this);
    } else {
        Log.i(TAG, "The Activity's LayoutInflater already has a Factory installed"
                + " so we can not install AppCompat's");
    }
}
 
开发者ID:evant,项目名称:simplefragment,代码行数:11,代码来源:SimpleFragmentDelegate.java

示例4: TypefaceCompatFactory

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
private TypefaceCompatFactory(Context context, boolean typefaceDetectionEnabled) {
    TypefaceCompat.initialize(typefaceDetectionEnabled);
    try {
        this.mBaseFactory = (LayoutInflaterFactory) ((AppCompatActivity) context).getDelegate();
    } catch (ClassCastException e) {
        e.printStackTrace();
    }
}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:9,代码来源:TypefaceCompatFactory.java

示例5: init

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
/**
     * 初始化夜间控制器
     * @param activity 上下文
     * @return
     */
    public ChangeModeController init(final Activity activity,final Class mClass){
        init();
        LayoutInflaterCompat.setFactory(LayoutInflater.from(activity), new LayoutInflaterFactory() {
            @Override
            public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
                View view = null;
                try {
                    if(name.indexOf('.') == -1){
                        if ("View".equals(name)) {
                            view = LayoutInflater.from(context).createView(name, "android.view.", attrs);
                        }
                        if (view == null) {
                            view = LayoutInflater.from(context).createView(name, "android.widget.", attrs);
                        }
                        if (view == null) {
                            view = LayoutInflater.from(context).createView(name, "android.webkit.", attrs);
                        }

                    }else{
                        if (view == null){
                            view = LayoutInflater.from(context).createView(name, null, attrs);
                        }
                    }
                    if(view != null){
                   // Log.e("TAG", "name = " + name);
                        for (int i = 0; i < attrs.getAttributeCount(); i++) {
//                            Log.e("TAG", attrs.getAttributeName(i) + " , " + attrs.getAttributeValue(i));
                            if (attrs.getAttributeName(i).equals(ATTR_BACKGROUND)) {
                                mBackGroundViews.add(new AttrEntity<View>(view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_TEXTCOLOR)) {
                                mOneTextColorViews.add(new AttrEntity<TextView>((TextView)view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_TWO_TEXTCOLOR)) {
                                mOneTextColorViews.add(new AttrEntity<TextView>((TextView)view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_THREE_TEXTCOLOR)) {
                                mOneTextColorViews.add(new AttrEntity<TextView>((TextView)view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_BACKGROUND_DRAWABLE)) {
                                mBackGroundDrawableViews.add(new AttrEntity<View>(view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }

                        }
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
                return view;
            }
        });
        return this;
    }
 
开发者ID:wp521,项目名称:MyFire,代码行数:59,代码来源:ChangeModeController.java

示例6: getLayoutInflaterFactory

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
LayoutInflaterFactory getLayoutInflaterFactory() {
    return this;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:FragmentManagerImpl.java

示例7: InflaterHandler

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
public InflaterHandler(LayoutInflaterFactory inflaterFactory, AppCompatActivity activity) {
    this.inflaterFactory = inflaterFactory;
    this.activity = activity;
}
 
开发者ID:wlt2017,项目名称:zhizhihuhu,代码行数:5,代码来源:NightModelManager.java

示例8: init

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
/**
     * 初始化夜间控制器
     * @param activity 上下文
     * @return
     */
    public ChangeModeController init(final Activity activity, final Class mClass){
        init();
        LayoutInflaterCompat.setFactory(LayoutInflater.from(activity), new LayoutInflaterFactory() {
            @Override
            public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
                View view = null;
                try {
                    if(name.indexOf('.') == -1){
                        if ("View".equals(name)) {
                            view = LayoutInflater.from(context).createView(name, "android.view.", attrs);
                        }
                        if (view == null) {
                            view = LayoutInflater.from(context).createView(name, "android.widget.", attrs);
                        }
                        if (view == null) {
                            view = LayoutInflater.from(context).createView(name, "android.webkit.", attrs);
                        }

                    }else{
                        if (view == null){
                            view = LayoutInflater.from(context).createView(name, null, attrs);
                        }
                    }
                    if(view != null){
                   // Log.e("TAG", "name = " + name);
                        for (int i = 0; i < attrs.getAttributeCount(); i++) {
//                            Log.e("TAG", attrs.getAttributeName(i) + " , " + attrs.getAttributeValue(i));
                            if (attrs.getAttributeName(i).equals(ATTR_BACKGROUND)) {
                                mBackGroundViews.add(new AttrEntity<View>(view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_TEXTCOLOR)) {
                                mOneTextColorViews.add(new AttrEntity<TextView>((TextView)view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_TWO_TEXTCOLOR)) {
                                mOneTextColorViews.add(new AttrEntity<TextView>((TextView)view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_THREE_TEXTCOLOR)) {
                                mOneTextColorViews.add(new AttrEntity<TextView>((TextView)view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }
                            if (attrs.getAttributeName(i).equals(ATTR_BACKGROUND_DRAWABLE)) {
                                mBackGroundDrawableViews.add(new AttrEntity<View>(view,getAttr(mClass,attrs.getAttributeValue(i))));
                            }

                        }
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
                return view;
            }
        });
        return this;
    }
 
开发者ID:git-xuhao,项目名称:DailyNews,代码行数:59,代码来源:ChangeModeController.java

示例9: getLayoutInflaterFactory

import android.support.v4.view.LayoutInflaterFactory; //导入依赖的package包/类
LayoutInflaterFactory getLayoutInflaterFactory()
{
    return this;
}
 
开发者ID:Hamz-a,项目名称:MyCTFWriteUps,代码行数:5,代码来源:FragmentManagerImpl.java


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