本文整理汇总了Java中android.databinding.DataBindingUtil.inflate方法的典型用法代码示例。如果您正苦于以下问题:Java DataBindingUtil.inflate方法的具体用法?Java DataBindingUtil.inflate怎么用?Java DataBindingUtil.inflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.databinding.DataBindingUtil
的用法示例。
在下文中一共展示了DataBindingUtil.inflate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildView
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
private void buildView(Context context, int width, int height, boolean systemAlert) {
LayoutInflater mInflater = LayoutInflater.from(context);
DialogToastBinding dialogToastBinding = DataBindingUtil.inflate(mInflater, R.layout.dialog_toast, null, false);
setContentView(dialogToastBinding.getRoot());
WindowManager.LayoutParams params = this.getWindow().getAttributes();
if (systemAlert) {
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
}
params.width = LayoutParams.WRAP_CONTENT;
params.height = LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.CENTER;
this.getWindow().setAttributes(params);
tvRemind = dialogToastBinding.remindText;
if (width > 0 && height > 0) {
LayoutParams lp = tvRemind.getLayoutParams();
lp.width = width;
lp.height = height;
tvRemind.setLayoutParams(lp);
}
}
示例2: onCreateViewHolder
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) {
case TYPE_HEADER_BOOK:
HeaderItemBookBinding mBindHeader = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.header_item_book, parent, false);
return new HeaderViewHolder(mBindHeader.getRoot());
case TYPE_FOOTER_BOOK:
FooterItemBookBinding mBindFooter = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.footer_item_book, parent, false);
return new FooterViewHolder(mBindFooter.getRoot());
default:
ItemBookBinding mBindBook = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_book, parent, false);
return new BookViewHolder(mBindBook.getRoot());
}
}
示例3: onActivityCreated
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// showLoading();
showContentView();
bindingView.llLoading.setVisibility(View.VISIBLE);
animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setDuration(3000);//设置动画持续时间
animation.setInterpolator(new LinearInterpolator());//不停顿
animation.setRepeatCount(10);
bindingView.ivLoading.setAnimation(animation);
animation.startNow();
maCache = ACache.get(getContext());
mEverydayModel = new EverydayModel();
mBannerImages = (ArrayList<String>) maCache.getAsObject(Constants.BANNER_PIC);
DebugUtil.error("----mBannerImages: " + (mBannerImages == null));
DebugUtil.error("----mLists: " + (mLists == null));
mHeaderBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.header_item_everyday, null, false);
// 设置本地数据点击事件等
initLocalSetting();
initRecyclerView();
mIsPrepared = true;
/**
* 因为启动时先走loadData()再走onActivityCreated,
* 所以此处要额外调用load(),不然最初不会加载内容
*/
loadData();
}
示例4: onCreateViewHolder
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
public PersonViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
PersonItemBinding binding = DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
R.layout.person_item, parent, false);
return new PersonViewHolder(binding);
}
示例5: onCreateView
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AddElephantRegistrationFragmentBinding binding = DataBindingUtil.inflate(inflater, R.layout.add_elephant_registration_fragment, container, false);
elephant = ((AddElephantActivity) getActivity()).getElephant();
View view = binding.getRoot();
binding.setE(elephant);
ButterKnife.bind(this, view);
KeyboardHelpers.hideKeyboardListener(view, getActivity());
return (view);
}
示例6: init
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
private void init(Context context) {
if(!isInEditMode()) {
LayoutInflater inflater = LayoutInflater.from(context);
mBinding = DataBindingUtil.inflate(
inflater, R.layout.layout_color_picker, this, true);
if (mColor == null) {
mColor = defaultColor();
}
}
}
示例7: beforeInitView
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
protected void beforeInitView() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_still, null, false);
setContentView(binding.getRoot());
binding.setData(this);
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
示例8: setUp
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
private void setUp(Context context, AttributeSet attrs, int defStyleAttr) {
inflater = LayoutInflater.from(context);
mBinding = DataBindingUtil.inflate(inflater, R.layout.layout_search, this, true);
mBinding.setPresenter(new Presenter());
allNames = SearchManger.getInstance(getContext()).getAllNames();
initAttr(context, attrs, defStyleAttr);
mBinding.svSearch.setOnQueryTextListener(this);
mBinding.svSearch.setOnQueryTextFocusChangeListener(this);
initHistoryData(allNames);
initNetTags(allNames);
initSuggestion();
initSearchView();
}
示例9: setUp
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
private void setUp(Context context, AttributeSet attrs, int defStyleAttr) {
mBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.layout_flex_search_1, this, true);
mBinding.setPresenter(new Presenter());
initAttr(context, attrs, defStyleAttr);
allNames = SearchManger.getInstance(getContext()).getAllSearchModels();
mBinding.svSearch.setOnQueryTextListener(this);
mBinding.svSearch.setOnQueryTextFocusChangeListener(this);
flexboxLayoutManager = new FlexboxLayoutManager(getContext());
flexboxLayoutManager.setFlexDirection(FlexDirection.COLUMN);
flexboxLayoutManager.setAlignContent(AlignContent.FLEX_START);
initHistoryData(allNames);
initNetTags(allNames);
initSuggestion();
initSearchView();
}
示例10: onCreateView
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
return binding.getRoot();
}
示例11: addCustomView
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
private View addCustomView() {
menuBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.layout_options, (ViewGroup) findViewById(R.id.parent), false);
menuBinding.btnApply.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
configurePullToRefreshView();
hideKeyboard();
fabMenu.closeMenu();
}
});
return menuBinding.getRoot();
}
示例12: VideoGridDialog
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
private VideoGridDialog(Context context) {
mContext = context;
mTitle = mContext.getString(R.string.videos);
mBuilder = new AlertDialog.Builder(context);
mLayoutManager = new GridLayoutManager(context, DEFAULT_GRID_COUNT);
mBinding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.dialog_video_grid, null, false);
mBuilder.setView(mBinding.getRoot());
mAdapter = new VideoGridAdapter(this);
mBinding.recyclerViewVideoGrid.setLayoutManager(mLayoutManager);
mBinding.recyclerViewVideoGrid.setAdapter(mAdapter);
}
示例13: onCreateView
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_facial_recognition, container, false);
return binding.getRoot();
}
示例14: onCreateViewHolder
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
public StepHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
StepListItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.step_list_item, parent, false);
return new StepHolder(binding);
}
示例15: createBinding
import android.databinding.DataBindingUtil; //导入方法依赖的package包/类
@Override
protected ItemBindingQuoteBinding createBinding(LayoutInflater inflater, ViewGroup parent) {
return DataBindingUtil.inflate(inflater, R.layout.item_binding_quote, parent, false);
}