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


Java LayoutInflater.getContext方法代码示例

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


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

示例1: produceLayout

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View produceLayout(LayoutInflater inflater, @Nullable ViewGroup container) {
    LinearLayout parent = new LinearLayout(inflater.getContext());
    parent.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    parent.setOrientation(VERTICAL);

    View child = origin.produceLayout(inflater, parent);
    LinearLayout.LayoutParams childParams = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    if (includeBottomBar) {
        childParams.weight = 1;
    }

    if (includeToolbar) {
        inflater.inflate(R.layout.toolbar, parent);
    }
    parent.addView(child, childParams);
    if (includeBottomBar) {
        AHBottomNavigation bottomNavigation = new AHBottomNavigation(parent.getContext());
        bottomNavigation.setId(R.id.bottomNavigation);
        parent.addView(
                bottomNavigation,
                new LinearLayout.LayoutParams(MATCH_PARENT, (int) dp(parent.getContext(), 56)));
    }

    return parent;
}
 
开发者ID:programmerr47,项目名称:navigation-widgets,代码行数:27,代码来源:NavigationLayoutFactory.java

示例2: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    context = inflater.getContext();
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.faq_wizard_layout, null);
    choose = (ListView) layout.findViewById(R.id.faq_wizard_list);
    title = (TextView) layout.findViewById(R.id.faq_wizard_title);
    choose.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (findStepById(currentId).to != null)
                jumpTo(findStepById(currentId).to[i]);
        }
    });
    data = getData();
    jumpTo(FIRST_ID);
    return layout;
}
 
开发者ID:w568w,项目名称:fuckView,代码行数:19,代码来源:FaqWizard.java

示例3: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final Context context = inflater.getContext();
       final Resources res = context.getResources();
	final View view = inflater.inflate(R.layout.fragment_directory, container, false);

       mProgressBar = (MaterialProgressBar) view.findViewById(R.id.progressBar);

	mEmptyView = (CompatTextView)view.findViewById(android.R.id.empty);

	mListView = (ListView) view.findViewById(R.id.list);
	mListView.setOnItemClickListener(mItemListener);
	mListView.setMultiChoiceModeListener(mMultiListener);
	mListView.setRecyclerListener(mRecycleListener);

       // Indent our list divider to align with text
       final Drawable divider = mListView.getDivider();
       final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left);
       final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset);
       if (insetLeft) {
           mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0));
       } else {
           mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0));
       }

	mGridView = (GridView) view.findViewById(R.id.grid);
	mGridView.setOnItemClickListener(mItemListener);
	mGridView.setMultiChoiceModeListener(mMultiListener);
	mGridView.setRecyclerListener(mRecycleListener);

	return view;
}
 
开发者ID:gigabytedevelopers,项目名称:FireFiles,代码行数:33,代码来源:DirectoryFragment.java

示例4: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    readBundle(getArguments());
    //:::::::::::::::::::::::::::: SUBMENUS ::::::::::::::::::::::::::::
    String [] subMenu = null;
    switch (choiceType){
        case ""+R.string.project:
            subMenu = getResources().getStringArray(R.array.subMenuProject);		            //PROJECT
            break;

        case ""+R.string.member:
            subMenu = getResources().getStringArray(R.array.subMenuMember);		                //INFORMATION
            break;

        case ""+R.string.cda:
            subMenu = getResources().getStringArray(R.array.subMenuCDA);		                //CDA
            break;

    }

    //---------- ListView by Sub-Menu -------------------------
    frameAdapterPager = new MainFrameFragmentPagerAdapter(getFragmentManager(), inflater.getContext(), subMenu, choiceType);
    frameAdapterPager.notifyDataSetChanged();

    // Set up the ViewPager with the sections adapter.
    mViewPager = rootView.findViewById(R.id.pager);
    mViewPager.setAdapter(frameAdapterPager);

    //----------------- Sub-Menu Music ------------------------------
    mIndicator = (TitlePageIndicator)getActivity().findViewById(R.id.indicator);
    mIndicator.setViewPager(mViewPager, R.color.white);

    return rootView;
}
 
开发者ID:codingdojoangola,项目名称:cda-app,代码行数:37,代码来源:MainFrameFragment.java

示例5: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    readBundle(getArguments());
    //:::::::::::::::::::::::::::: SUBMENUS ::::::::::::::::::::::::::::
    String [] subMenu = null;
    switch (choiceType){
        case ""+R.string.project:
            subMenu = getResources().getStringArray(R.array.subMenuProject);		            //PROJECT
            break;

        case ""+R.string.member:
            subMenu = getResources().getStringArray(R.array.subMenuMember);		        //INFORMATION
            break;

        case ""+R.string.cda:
            subMenu = getResources().getStringArray(R.array.subMenuCDA);		                //CDA
            break;

    }

    //---------- ListView by Sub-Menu -------------------------
    frameAdapterPager = new FrameAdapterPager(getFragmentManager(), inflater.getContext(), subMenu);
    frameAdapterPager.notifyDataSetChanged();

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager)rootView.findViewById(R.id.pager);
    mViewPager.setAdapter(frameAdapterPager);

    //----------------- Sub-Menu Music ------------------------------
    mIndicator = (TitlePageIndicator)getActivity().findViewById(R.id.indicator);
    mIndicator.setViewPager(mViewPager, R.color.white);


    return rootView;
}
 
开发者ID:codingdojoangola,项目名称:cda-app,代码行数:38,代码来源:FrameMain.java

示例6: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@NonNull
@Override
protected final View onCreateView(@NonNull LayoutInflater inflater,
    @NonNull ViewGroup container) {
  View view = new FrameLayout(inflater.getContext());
  view.setId(getContainerId());
  return view;
}
 
开发者ID:seven332,项目名称:Stage,代码行数:9,代码来源:FragmentScene.java

示例7: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = inflater.getContext();

    final View view = inflater.inflate(R.layout.fragment_directory, container, false);

    mEmptyView = view.findViewById(android.R.id.empty);

    mListView = (ListView) view.findViewById(R.id.list);
    mListView.setOnItemClickListener(mItemListener);
    return view;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:14,代码来源:RecentsCreateFragment.java

示例8: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Nullable
@Override
@CallSuper
public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
    final View superView = super.onCreateView(inflater, container, savedInstanceState);

    // it seems impossible to go in here, but it's Android, so.. check if not parsed by now
    final Context context = getContext() == null ? inflater.getContext() : getContext();
    if (!mIsParsed && context != null) {
        AnnotationParser.parseType(context, this);
        mIsParsed = true;
    }

    // inflate and parse views now
    if (getLayoutId() > 0 && context != null) {
        final View contentView = inflater.inflate(getLayoutId(), container, false);
        // using 'this' instead of a new wrapper won't work because the wrapper uses #getView(), which will at this point return null
        if (mFoundViews != null) {
            mFoundViews.clear();
        }
        mFoundViews = AnnotationParser.parseFields(context, this, new LayoutWrapper() {
            @Override
            public <ViewType extends View> ViewType findView(@IdRes final int viewId) {
                return SillyAndroid.findViewById(contentView, viewId);
            }
        });
    }

    return superView; // nothing worked, go super.
}
 
开发者ID:milosmns,项目名称:silly-android,代码行数:34,代码来源:ParsableFragment.java

示例9: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Nullable
@Override
@CallSuper
public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
    final Context fragmentContext = getContext();
    final Context paramContext = container != null ? container.getContext() : inflater.getContext();
    if (fragmentContext instanceof Activity) {
        mKeyboardListener = SillyAndroid.listenToKeyboard(this, (Activity) fragmentContext);
    } else if (paramContext instanceof Activity) {
        mKeyboardListener = SillyAndroid.listenToKeyboard(this, (Activity) paramContext);
    }
    return super.onCreateView(inflater, container, savedInstanceState);
}
 
开发者ID:milosmns,项目名称:silly-android,代码行数:14,代码来源:EasyFragment.java

示例10: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
        savedInstanceState) {
    HomeView view = new HomeView(inflater.getContext());
    view.setHeaderView(inflater.inflate(R.layout.h2, container, false));
    this.webview = view.getWebView();
    return view;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:GoodsHomeFragment.java

示例11: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return new RecyclerView(inflater.getContext());
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:5,代码来源:ViewPagerUsingFragment.java

示例12: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@NonNull
@Override
protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
  return new View(inflater.getContext());
}
 
开发者ID:seven332,项目名称:Stage,代码行数:6,代码来源:SceneLifecycleTest.java

示例13: create

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public ViewGroup create(LayoutInflater layoutInflater, ViewGroup container) {
    ViewGroup4 viewGroup4 = new ViewGroup4(layoutInflater.getContext(), num);
    container.addView(viewGroup4);
    return viewGroup4;
}
 
开发者ID:kevinwang5658,项目名称:backstack,代码行数:7,代码来源:ViewGroup4.java

示例14: ApkLayoutInflater

import android.view.LayoutInflater; //导入方法依赖的package包/类
public ApkLayoutInflater(LayoutInflater target) {
    super(target.getContext());
    this.target = target;
}
 
开发者ID:LiangMaYong,项目名称:android-apkbox,代码行数:5,代码来源:ApkLayoutInflater.java

示例15: onCreateView

import android.view.LayoutInflater; //导入方法依赖的package包/类
@Deprecated
protected final void onCreateView(Bundle savedInstanceState) {
    super.onCreateView(savedInstanceState);
    this.savedInstanceState = savedInstanceState;
    Bundle bundle = getArguments();
    if (bundle != null) {
        isLazyLoad = bundle.getBoolean(INTENT_BOOLEAN_LAZYLOAD, isLazyLoad);
    }
    //为什么不直接getUserVisibleHint();而是通过自己存isVisibleToUserState变量判断
    //因为v4的25的版本 已经调用 setUserVisibleHint(true),结果到这里getUserVisibleHint是false
    // (ps:看了FragmentManager源码Fragment被重新创建有直接赋值isVisibleToUser不知道是不是那里和之前v4有改动的地方)
    //所以我默认VISIBLE_STATE_NOTSET,之前没有调用setUserVisibleHint方法,就用系统的getUserVisibleHint,否则就用setUserVisibleHint后保存的值
    //总之就是调用了setUserVisibleHint 就使用setUserVisibleHint的值
    boolean isVisibleToUser;
    if (isVisibleToUserState == VISIBLE_STATE_NOTSET) {
        isVisibleToUser = getUserVisibleHint();
    } else {
        isVisibleToUser = isVisibleToUserState == VISIBLE_STATE_VISIABLE;
    }
    if (isLazyLoad) {
        if (isVisibleToUser && !isInit) {
            isInit = true;
            onCreateViewLazy(savedInstanceState);
        } else {
            LayoutInflater layoutInflater = inflater;
            if (layoutInflater == null) {
                layoutInflater = LayoutInflater.from(getApplicationContext());
            }
            layout = new FrameLayout(layoutInflater.getContext());
            View view = getPreviewLayout(layoutInflater, layout);
            if (view != null) {
                layout.addView(view);
            }
            layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
            super.setContentView(layout);
        }
    } else {
        isInit = true;
        onCreateViewLazy(savedInstanceState);
    }
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:42,代码来源:LazyFragment.java


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