本文整理匯總了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);
}