android.support.v4.view.LayoutInflaterFactory Java Examples
The following examples show how to use
android.support.v4.view.LayoutInflaterFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangeModeController.java From youqu_master with Apache License 2.0 | 4 votes |
/** * 初始化夜间控制器 * @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; }
Example #2
Source File: FragmentManagerImpl.java From letv with Apache License 2.0 | 4 votes |
LayoutInflaterFactory getLayoutInflaterFactory() { return this; }
Example #3
Source File: TypefaceCompatFactory.java From AppCompat-Extension-Library with Apache License 2.0 | 4 votes |
@Deprecated private TypefaceCompatFactory(Context context, boolean typefaceDetectionEnabled) { TypefaceCompat.setTypefaceDetectionEnabled(typefaceDetectionEnabled); try { this.mBaseFactory = (LayoutInflaterFactory) ((AppCompatActivity) context).getDelegate(); } catch (ClassCastException e) { e.printStackTrace(); } }