@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create ContextThemeWrapper from the original Activity Context with the custom theme final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.yourCustomTheme); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); // inflate the layout using the cloned inflater, not default inflater return localInflater.inflate(R.layout.yourLayout, container, false); }
@Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (inflater == null) { inflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return inflater; } return super.getSystemService(name); }
@Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (inflater == null) { inflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return inflater; } return super.getSystemService(name); } }
@Test public void createPackageContext() throws Exception { Context packageContext = context.createPackageContext(context.getPackageName(), 0); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.cloneInContext(packageContext); inflater.inflate(R.layout.remote_views, new FrameLayout(context), false); }
public LayoutInflater inflater(Context context) { return LayoutInflater.from(context).cloneInContext(createContext(context)); }
public LayoutInflater inflater(Context context) { return LayoutInflater.from(context).cloneInContext(createContext(context)); }
@Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (inflater == null) { inflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return inflater; } if (ExtensionProvider.NAME.equals(name)) { return extension; } return super.getSystemService(name); } }
@Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (mInflater == null) { mInflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return mInflater; } Object service = getBaseContext().getSystemService(name); if (service == null) { service = LocalServiceManager.getService(name); } return service; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { int themeRes = getArguments().getInt(ARGUMENT_THEME_RES); Context contextThemeWrapper; if (themeRes != 0) { contextThemeWrapper = new ContextThemeWrapper(getActivity(), themeRes); } else { contextThemeWrapper = getActivity(); } LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); return localInflater.inflate(getArguments().getInt(ARGUMENT_LAYOUT_RES), container, false); } }
layoutInflater = layoutInflater.cloneInContext(new ContextThemeWrapper(activity, themeRes));
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { int style = getTheme(); // create ContextThemeWrapper from the original Activity Context with the custom theme final Context contextThemeWrapper = new android.view.ContextThemeWrapper(getActivity(), style); LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); View rootView = localInflater.inflate(R.layout.mal_material_about_fragment, container, false); recyclerView = (RecyclerView) rootView.findViewById(R.id.mal_recyclerview); adapter = new MaterialAboutListAdapter(getViewTypeManager()); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(adapter); RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator(); if (animator instanceof SimpleItemAnimator) { ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false); } recyclerView.setAlpha(0f); recyclerView.setTranslationY(20); ListTask task = new ListTask(getActivity()); task.execute(); return rootView; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create ContextThemeWrapper from the original Activity Context with the custom theme final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.yourCustomTheme); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); // inflate the layout using the cloned inflater, not default inflater return localInflater.inflate(R.layout.yourLayout, container, false); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.Picker_Black); LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); View v = localInflater.inflate(R.layout.fragment_booking, container, false); return v; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.yourtheme); LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); return localInflater.inflate(R.layout.yourfragment, container, false); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create ContextThemeWrapper from the original Activity Context with the custom theme Context context = new ContextThemeWrapper(getActivity(), R.style.My_Custom_Theme); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.cloneInContext(context); // inflate using the cloned inflater, not the passed in default return localInflater.inflate(R.layout.my_layout, container, false); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Context context = new ContextThemeWrapper(getActivity(), R.style.Beam_Light); LayoutInflater localInflater = inflater.cloneInContext(context); final View root = localInflater.inflate(R.layout.sv_contact_info_fragment, container, false); LinearLayout dynamicLayout = (LinearLayout) root.findViewById(R.id.beam_contact_info_fragment_lchild); View view = localInflater.inflate(R.layout.sv_header, null); dynamicLayout.addView(view); }
private void initLayoutInflater() { LayoutInflater layoutInflater = ((LayoutInflater) mContentProxy.getContext().getSystemService(Context .LAYOUT_INFLATER_SERVICE)); if (null != layoutInflater) { mLayoutInflater = layoutInflater.cloneInContext(this); } } }
@Override public Object getSystemService(@NonNull String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { LayoutInflater layoutInflater = (LayoutInflater) mPluginContext.getSystemService(name); return layoutInflater.cloneInContext(this); } return mOriginActivity.getSystemService(name); }
@Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (mInflater == null) { mInflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return mInflater; } return super.getSystemService(name); }
LayoutInflater inflater = LayoutInflater.from(context); if (inflater.getFactory() != null) { inflater = inflater.cloneInContext(context); } inflater.setFactory(factory);