本文整理了Java中android.app.Activity.getLayoutInflater()
方法的一些代码示例,展示了Activity.getLayoutInflater()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getLayoutInflater()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:getLayoutInflater
暂无
代码示例来源:origin: TommyLemon/Android-ZBLibrary
public BottomMenuView(Activity context, int toBottomMenuWindowRequestCode) {
super(context, R.layout.bottom_menu_view);
this.inflater = context.getLayoutInflater();
this.toBottomMenuWindowRequestCode = toBottomMenuWindowRequestCode;
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
public TopTabView(Activity context) {
super(context, R.layout.top_tab_view);
this.inflater = context.getLayoutInflater();
}
private int minWidth;
代码示例来源:origin: chrisjenx/Calligraphy
/**
* Get the Calligraphy Activity Fragment Instance to allow callbacks for when views are created.
*
* @param activity The activity the original that the ContextWrapper was attached too.
* @return Interface allowing you to call onActivityViewCreated
*/
static CalligraphyActivityFactory get(Activity activity) {
if (!(activity.getLayoutInflater() instanceof CalligraphyLayoutInflater)) {
throw new RuntimeException("This activity does not wrap the Base Context! See CalligraphyContextWrapper.wrap(Context)");
}
return (CalligraphyActivityFactory) activity.getLayoutInflater();
}
代码示例来源:origin: jeasonlzy/ImagePicker
public DialogAdapter(List<String> strings) {
this.mStrings = strings;
this.layoutInflater=mActivity.getLayoutInflater();
}
代码示例来源:origin: TommyLemon/APIJSON
public BaseAdapter(Activity context) {
this.context = context;
inflater = context.getLayoutInflater();
resources = context.getResources();
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
public GridPickerAdapter(Activity context, int currentPosition, int height) {
this.context = context;
this.inflater = context.getLayoutInflater();
this.resources = context.getResources();
this.currentPosition = currentPosition;
this.height = height;
}
代码示例来源:origin: bumptech/glide
@Override
public GifViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = activity.getLayoutInflater().inflate(R.layout.gif_list_item, parent, false);
return new GifViewHolder(view);
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
/**
* @param context
* @param layoutResId
* @param parent TODO 如果itemView不能占满宽度 或 高度不对,一般是RecyclerView的问题,可通过传parent解决
*/
public BaseView(Activity context, @LayoutRes int layoutResId, ViewGroup parent) {
this(context, context.getLayoutInflater().inflate(layoutResId, parent, false));
}
/**
代码示例来源:origin: mikepenz/MaterialDrawer
/**
* You can pass a custom layout for the drawer lib. see the drawer.xml in layouts of this lib on GitHub
*
* @param resLayout
* @return
*/
public AccountHeaderBuilder withAccountHeader(@LayoutRes int resLayout) {
if (mActivity == null) {
throw new RuntimeException("please pass an activity first to use this call");
}
if (resLayout != -1) {
this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(resLayout, null, false);
} else {
if (mCompactStyle) {
this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(R.layout.material_drawer_compact_header, null, false);
} else {
this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(R.layout.material_drawer_header, null, false);
}
}
return this;
}
代码示例来源:origin: mikepenz/MaterialDrawer
/**
* Add a footer to the DrawerBuilder ListView defined by a resource.
*
* @param footerViewRes
* @return
*/
public DrawerBuilder withFooter(@LayoutRes int footerViewRes) {
if (mActivity == null) {
throw new RuntimeException("please pass an activity first to use this call");
}
if (footerViewRes != -1) {
//i know there should be a root, bit i got none here
this.mFooterView = mActivity.getLayoutInflater().inflate(footerViewRes, null, false);
}
return this;
}
代码示例来源:origin: mikepenz/MaterialDrawer
/**
* Add a header to the DrawerBuilder ListView defined by a resource.
*
* @param headerViewRes
* @return
*/
public DrawerBuilder withHeader(@LayoutRes int headerViewRes) {
if (mActivity == null) {
throw new RuntimeException("please pass an activity first to use this call");
}
if (headerViewRes != -1) {
//i know there should be a root, bit i got none here
this.mHeaderView = mActivity.getLayoutInflater().inflate(headerViewRes, null, false);
}
return this;
}
代码示例来源:origin: mikepenz/MaterialDrawer
/**
* Add a sticky header below the DrawerBuilder ListView defined by a resource.
*
* @param stickyHeaderRes
* @return
*/
public DrawerBuilder withStickyHeader(@LayoutRes int stickyHeaderRes) {
if (mActivity == null) {
throw new RuntimeException("please pass an activity first to use this call");
}
if (stickyHeaderRes != -1) {
//i know there should be a root, bit i got none here
this.mStickyHeaderView = mActivity.getLayoutInflater().inflate(stickyHeaderRes, null, false);
}
return this;
}
代码示例来源:origin: mikepenz/MaterialDrawer
/**
* Add a sticky footer below the DrawerBuilder ListView defined by a resource.
*
* @param stickyFooterRes
* @return
*/
public DrawerBuilder withStickyFooter(@LayoutRes int stickyFooterRes) {
if (mActivity == null) {
throw new RuntimeException("please pass an activity first to use this call");
}
if (stickyFooterRes != -1) {
//i know there should be a root, bit i got none here
this.mStickyFooterView = (ViewGroup) mActivity.getLayoutInflater().inflate(stickyFooterRes, null, false);
}
return this;
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
public BaseAdapter(Activity context) {
setHasStableIds(false);
this.context = context;
this.inflater = context.getLayoutInflater();
this.resources = context.getResources();
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
public GridAdapter(Activity context, int layoutRes) {
this.context = context;
this.inflater = context.getLayoutInflater();
setLayoutRes(layoutRes);
}
代码示例来源:origin: facebook/facebook-android-sdk
@Override
void setupViews(ViewGroup view) {
if (showSearchBox) {
ListView listView = (ListView) view.findViewById(R.id.com_facebook_picker_list_view);
View searchHeaderView = getActivity().getLayoutInflater().inflate(
R.layout.picker_search_box, listView, false);
listView.addHeaderView(searchHeaderView, null, false);
searchBox = (EditText) view.findViewById(R.id.com_facebook_picker_search_text);
searchBox.addTextChangedListener(new SearchTextWatcher());
if (!TextUtils.isEmpty(searchText)) {
searchBox.setText(searchText);
}
}
}
代码示例来源:origin: rengwuxian/RxJavaSamples
@OnClick(R.id.tipBt)
void tip() {
new AlertDialog.Builder(getActivity())
.setTitle(getTitleRes())
.setView(getActivity().getLayoutInflater().inflate(getDialogRes(), null))
.show();
}
代码示例来源:origin: TommyLemon/APIJSON
public void createView(BaseView<T> bv) {
this.bv = bv;
removeAllViews();
super.addView(bv.createView(context.getLayoutInflater()));
bindView(null);
}
代码示例来源:origin: robolectric/robolectric
@Test @Config(qualifiers = "sw720dp")
public void inflateLayout_overridesTo_sw720dp() throws Exception {
View view = Robolectric.setupActivity(Activity.class).getLayoutInflater().inflate(R.layout.layout_smallest_width, null);
TextView textView = view.findViewById(R.id.text1);
assertThat(textView.getText()).isEqualTo("720");
assertThat(resources.getConfiguration().smallestScreenWidthDp).isEqualTo(720);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void inflateLayout_defaultsTo_sw320dp() throws Exception {
View view = Robolectric.setupActivity(Activity.class).getLayoutInflater().inflate(R.layout.layout_smallest_width, null);
TextView textView = view.findViewById(R.id.text1);
assertThat(textView.getText()).isEqualTo("320");
assertThat(resources.getConfiguration().smallestScreenWidthDp).isEqualTo(320);
}
内容来源于网络,如有侵权,请联系作者删除!