本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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.
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}