当前位置: 首页>>代码示例>>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;未经允许,请勿转载。