當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。