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


Java DataBindingUtil.inflate方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:coderJohnZhang,项目名称:TvDialog,代码行数:23,代码来源:ToastDialog.java

示例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());
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:15,代码来源:BookAdapter.java

示例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();
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:33,代码来源:EverydayFragment.java

示例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);
}
 
开发者ID:cyrilpillai,项目名称:GreenDao-Migrator,代码行数:8,代码来源:PersonAdapter.java

示例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);
}
 
开发者ID:goutfeb,项目名称:ElephantAsia,代码行数:11,代码来源:AddRegistrationFragment.java

示例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();
        }
    }
}
 
开发者ID:google,项目名称:spline,代码行数:12,代码来源:ColorPicker.java

示例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);
}
 
开发者ID:Mindjet,项目名称:LiteReader,代码行数:9,代码来源:StillDialog.java

示例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();
}
 
开发者ID:xieyangxuejun,项目名称:SearchLayout,代码行数:14,代码来源:FlowSearchLayout.java

示例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();
}
 
开发者ID:xieyangxuejun,项目名称:SearchLayout,代码行数:16,代码来源:FlexSearchLayout.java

示例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();
}
 
开发者ID:jakdor,项目名称:LabDayApp,代码行数:8,代码来源:MainFragment.java

示例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();
}
 
开发者ID:HarinTrivedi,项目名称:AnimatedPullToRefresh-master,代码行数:15,代码来源:MainActivity.java

示例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);
}
 
开发者ID:scaffeinate,项目名称:Inflix,代码行数:12,代码来源:VideoGridDialog.java

示例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();
}
 
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:7,代码来源:FacialRecognitionFragment.java

示例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);
}
 
开发者ID:twisstosin,项目名称:UdacityBakingAndroid,代码行数:7,代码来源:StepAdapter.java

示例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);
}
 
开发者ID:DevAhamed,项目名称:MultiViewAdapter,代码行数:5,代码来源:QuoteDataBinder.java


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