當前位置: 首頁>>代碼示例>>Java>>正文


Java MenuInflater.inflate方法代碼示例

本文整理匯總了Java中android.view.MenuInflater.inflate方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuInflater.inflate方法的具體用法?Java MenuInflater.inflate怎麽用?Java MenuInflater.inflate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.MenuInflater的用法示例。


在下文中一共展示了MenuInflater.inflate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@SuppressLint("SetTextI18n")
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_detail, menu);
    MenuItem item = menu.findItem(R.id.menu_scroll_comment);
    if (item != null) {
        View action = item.getActionView();
        if (action != null) {
            View tv = action.findViewById(R.id.tv_comment_count);
            if (tv != null && mBean != null) {
                mCommentCountView = (TextView) tv;
                if (mBean.getStatistics() != null)
                    mCommentCountView.setText(mBean.getStatistics().getComment() + "");
            }
        }
    }
    return true;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:20,代碼來源:DetailActivity.java

示例2: onPostCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onPostCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
	menuInflater.inflate(R.menu.menu_channel_list, menu);
	
	TGActivity activity = (TGActivity) getActivity();
	TGChannelListMenu.getInstance(this.findContext()).initialize(activity, menu);
}
 
開發者ID:axlecho,項目名稱:tuxguitar,代碼行數:8,代碼來源:TGChannelListFragment.java

示例3: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
    if (getMenuFragmentResources() != -1) {
        inflater.inflate(getMenuFragmentResources(), menu);
    } else {
        menu.clear();
    }
    super.onCreateOptionsMenu(menu, inflater);
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:10,代碼來源:AbstractFragment.java

示例4: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu1, menu);
    return true;

    // To make Menu without XML,
    // use menu.add(group, id, order, title) method.
}
 
開發者ID:Jamjomjara,項目名稱:snu-artoon,代碼行數:11,代碼來源:MainActivity.java

示例5: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_backup_list, menu);

    mAppMenu = menu;
    //enabled when a backup selected
    mAppMenu.setGroupVisible(R.id.mnu_backup_list, false);

    return true;
}
 
開發者ID:mkeresztes,項目名稱:AndiCar,代碼行數:12,代碼來源:BackupListActivity.java

示例6: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    inflater.inflate(R.menu.main_activity, menu);

    return true;
}
 
開發者ID:bitcoinbull,項目名稱:biniu-index,代碼行數:8,代碼來源:MainActivity.java

示例7: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();
    inflater.inflate(R.menu.menu, menu);
    super.onCreateOptionsMenu(menu, inflater);
}
 
開發者ID:mzdhr,項目名稱:WarningSystemWeather-Android-App,代碼行數:7,代碼來源:ListFragment.java

示例8: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.edit_profile, menu);
    return true;
}
 
開發者ID:rozdoum,項目名稱:social-app-android,代碼行數:7,代碼來源:EditProfileActivity.java

示例9: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.main, menu);
    super.onCreateOptionsMenu(menu, inflater);
}
 
開發者ID:setakarim,項目名稱:ingetin,代碼行數:6,代碼來源:LainnyaFragment.java

示例10: onMenuClicked

import android.view.MenuInflater; //導入方法依賴的package包/類
public void onMenuClicked(View v, @NonNull RepoFile item) {
        if (isRefreshing) return;

        boolean isOwner = repoDetailViewModel.isOwnerOrCollaborator();

        PopupMenu popup = new PopupMenu(getContext(), v);
        MenuInflater inflater = popup.getMenuInflater();
        inflater.inflate(R.menu.download_share_menu, popup.getMenu());
        popup.getMenu().findItem(R.id.download).setVisible(item.getType() == FilesType.file);
        boolean canOpen = canOpen(item);
        popup.getMenu().findItem(R.id.editFile).setVisible(isOwner && item.getType() == FilesType.file && canOpen);
        popup.getMenu().findItem(R.id.deleteFile).setVisible(isOwner && item.getType() == FilesType.file);
        popup.setOnMenuItemClickListener(item1 -> {
            switch (item1.getItemId()) {
                case R.id.share:
                    ActivityHelper.shareUrl(getContext(), item.getHtmlUrl());
                    break;
                case R.id.download:
                    if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) {
                        DownloadHelper.downloadFile(getContext().getApplicationContext(), item.getDownloadUrl());
                    }
                    break;
                case R.id.copy:
                    AppHelper.copyToClipboard(getContext(), !InputHelper.isEmpty(item.getHtmlUrl()) ? item.getHtmlUrl() : item.getUrl());
                    break;
                case R.id.editFile:
                    AlertUtils.showToastShortMessage(getContext(), "Coming soon...");
//                    if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) {
//                        if (canOpen) {
//                            EditRepoFileModel fileModel = new EditRepoFileModel(getPresenter().login, getPresenter().repoId,
//                                    item.getPath(), getPresenter().ref, item.getSha(), item.getDownloadUrl(), item.getName(), true);
//                            EditRepoFileActivity.Companion.startForResult(this, fileModel, isEnterprise());
//                        }
//                    } else {
//                        PremiumActivity.Companion.startActivity(getContext());
//                    }
                    break;
                case R.id.deleteFile:
                    AlertUtils.showToastShortMessage(getContext(), "Coming soon...");
//                    if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) {
//                        DeleteFileBottomSheetFragment.Companion.newInstance(position, item.getName())
//                                .show(getChildFragmentManager(), DeleteFileBottomSheetFragment.class.getSimpleName());
//                    } else {
//                        PremiumActivity.Companion.startActivity(getContext());
//                    }
                    break;
            }
            return true;
        });
        popup.show();
    }
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:52,代碼來源:RepoFilesFragment.java

示例11: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate (R.menu.default_menu, menu);
    super.onCreateOptionsMenu(menu, inflater);
}
 
開發者ID:humaniq,項目名稱:humaniq-android,代碼行數:6,代碼來源:HistoryFragment.java

示例12: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_more, menu);
    super.onCreateOptionsMenu(menu, inflater);
}
 
開發者ID:makezhao,項目名稱:LianXiZhihu,代碼行數:6,代碼來源:DetailFragment.java

示例13: inflate

import android.view.MenuInflater; //導入方法依賴的package包/類
public void inflate(ContextMenu menu, MenuInflater inflater) {
	menu.setHeaderTitle(R.string.menu_caret);
	inflater.inflate(R.menu.menu_caret, menu);
	initializeItems(menu);
}
 
開發者ID:axlecho,項目名稱:tuxguitar,代碼行數:6,代碼來源:TGCaretMenu.java

示例14: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu,menu);
    return super.onCreateOptionsMenu(menu);
}
 
開發者ID:amir511,項目名稱:My-Sheep,代碼行數:7,代碼來源:KidDetail.java

示例15: onCreateOptionsMenu

import android.view.MenuInflater; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	super.onCreateOptionsMenu(menu, inflater);
	inflater.inflate(edu.osu.siyang.smartform.R.menu.fragment_test, menu);
}
 
開發者ID:publiclab,項目名稱:SmART-Form,代碼行數:6,代碼來源:TestFragment.java


注:本文中的android.view.MenuInflater.inflate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。