本文整理匯總了Java中android.support.v7.widget.ActionMenuView.getMenu方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionMenuView.getMenu方法的具體用法?Java ActionMenuView.getMenu怎麽用?Java ActionMenuView.getMenu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.ActionMenuView
的用法示例。
在下文中一共展示了ActionMenuView.getMenu方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.GONE);
inflater.inflate(R.menu.main, menu);
MenuItem item = menu.add(1, 1001, 1, getString(R.string.grid_carousel));
if (carousel) {
item.setIcon(R.drawable.gridview);
} else {
item.setIcon(R.drawable.carousel);
}
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}
示例2: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.VISIBLE);
inflater.inflate(R.menu.main, actionMenuView.getMenu());
MenuItem item = actionMenu.add(1, 1001, 1, getString(R.string.grid_carousel));
if (carousel) {
item.setIcon(R.drawable.gridview);
} else {
item.setIcon(R.drawable.carousel);
}
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}
示例3: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.GONE);
}
示例4: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.GONE);
inflater.inflate(R.menu.main, menu);
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}
示例5: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.GONE);
MenuItem item = menu.add(1, REFRESH, 0, R.string.refresh);
item.setIcon(R.drawable.ic_menu_refresh);
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
示例6: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
menu.clear();
Activity activity = getActivity();
ActionMenuView actionMenuView = ((ListHolderActivity) activity).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.GONE);
/* MenuItem truePicker = actionMenu.add(1, 1011, 1, R.string.truepicker);
LayoutInflater layoutInflater = activity.getLayoutInflater();
View truePickerView = layoutInflater.inflate(R.layout.truepicker_logo, null, false);
truePickerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent;
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://truepicker.com/"));
startActivity(intent);
}
});
MenuItemCompat.setActionView(truePicker, truePickerView);
MenuItemCompat.setShowAsAction(truePicker, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
truePicker.setIcon(R.drawable.truepicker_logo);*/
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}
示例7: setUpMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
public void setUpMenu(final ActionMenuView actionMenu, final DrawerLayout drawerLayout, final View bookmarksPanel ) {
this.drawerLayout = drawerLayout;
this.bookmarksPanel = bookmarksPanel;
this.actionMenu = actionMenu;
actionMenu.setOnMenuItemClickListener(this);
// Enable special buttons
Menu menu = actionMenu.getMenu();
PackageManager pm = context.getPackageManager();
menu.findItem(R.id.action_backgroundPlay).setChecked(sp.getBoolean(BackgroundPlayHelper.PREF_BACKGROUND_PLAY_ENABLED, true));
menu.findItem(R.id.action_accept_cookies).setChecked(sp.getBoolean(PREF_COOKIES_ENABLED,true));
// Tor button
if (OrbotHelper.isOrbotInstalled(context.getApplicationContext())) {
menu.findItem(R.id.action_tor)
.setEnabled(true)
.setChecked(sp.getBoolean(TorHelper.PREF_TOR_ENABLED, false));
}
// Add Kodi button
try {
pm.getPackageInfo("org.xbmc.kore", PackageManager.GET_ACTIVITIES);
menu.findItem(R.id.action_cast_to_kodi).setEnabled(true);
} catch (PackageManager.NameNotFoundException e) {
/* Kodi is not installed */
}
}
示例8: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
actionMenuView.getMenu().clear();
MenuItem add = menu.add(1, ADD_CHANNEL, 0, R.string.add_channel);
add.setIcon(R.drawable.ic_menu_add);
MenuItemCompat.setShowAsAction(add, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (Build.VERSION.SDK_INT < 14) {
preferences.edit().putInt("player_type", 1).commit();
actionMenuView.setVisibility(View.GONE);
} else {
actionMenuView.setVisibility(View.VISIBLE);
int currentPlayer = preferences.getInt("player_type", 0);
Menu actionMenu = actionMenuView.getMenu();
MenuItem player = actionMenu.add(1, PLAYER_TYPE, 1, getResources().getStringArray(R.array.player_types)[currentPlayer]);
MenuItemCompat.setShowAsAction(player, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}
}
示例9: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
ActionMenuView actionMenuView = ((ListHolderActivity) getActivity()).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.VISIBLE);
inflater.inflate(R.menu.main, actionMenu);
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}
示例10: onCreateOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
menu.clear();
Activity activity = getActivity();
ActionMenuView actionMenuView = ((ListHolderActivity) activity).getActionMenuView();
Menu actionMenu = actionMenuView.getMenu();
actionMenu.clear();
actionMenuView.setVisibility(View.VISIBLE);
MenuItem truePicker = actionMenu.add(1, 1011, 1, R.string.truepicker);
LayoutInflater layoutInflater = activity.getLayoutInflater();
View truePickerView = layoutInflater.inflate(R.layout.truepicker_logo, null, false);
truePickerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent;
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://truepicker.com/"));
startActivity(intent);
}
});
MenuItemCompat.setActionView(truePicker, truePickerView);
MenuItemCompat.setShowAsAction(truePicker, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
truePicker.setIcon(R.drawable.truepicker_logo);
actionMenuView.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
});
}