本文整理了Java中android.view.MenuItem.setActionView()
方法的一些代码示例,展示了MenuItem.setActionView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.setActionView()
方法的具体详情如下:
包路径:android.view.MenuItem
类名称:MenuItem
方法名:setActionView
暂无
代码示例来源:origin: k9mail/k-9
public void run() {
if (progress) {
refreshMenuItem.setActionView(actionBarProgressView);
} else {
refreshMenuItem.setActionView(null);
}
}
});
代码示例来源:origin: k9mail/k-9
public void run() {
if (progress) {
refreshMenuItem.setActionView(R.layout.actionbar_indeterminate_progress_actionview);
} else {
refreshMenuItem.setActionView(null);
}
}
});
代码示例来源:origin: stackoverflow.com
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
MenuItem item = menu.findItem(R.id.on_off_switch);
item.setActionView(R.layout.on_off_switch);
return true;
}
代码示例来源:origin: stackoverflow.com
MenuItem item = abmenu.findItem(R.id.refresh_option);
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View abprogress = inflater.inflate(R.layout.progress_wheel, null);
item.setActionView(abprogress);
代码示例来源:origin: k9mail/k-9
@Override
public void enableActionBarProgress(boolean enable) {
if (menuButtonCheckMail == null) {
return;
}
if (menuButtonCheckMail.isVisible()) {
menuButtonCheckMail.setActionView(enable ? actionButtonIndeterminateProgress : null);
} else {
menuButtonCheckMail.setActionView(null);
}
}
代码示例来源:origin: frogermcs/InstaMaterial
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
inboxMenuItem = menu.findItem(R.id.action_inbox);
inboxMenuItem.setActionView(R.layout.menu_item_view);
return true;
}
代码示例来源:origin: stackoverflow.com
SearchView sv = new SearchView(getActivity());
sv.setOnQueryTextListener(this);
item.setActionView(sv);
代码示例来源:origin: stackoverflow.com
SearchView sv = new SearchView(getActivity());
sv.setOnQueryTextListener(this);
item.setActionView(sv);
代码示例来源:origin: robolectric/robolectric
@Test
public void expandActionView_shouldReturnFalseIfActionViewIsNull() throws Exception {
item.setActionView(null);
assertThat(item.expandActionView()).isFalse();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void collapseActionView_shouldReturnFalseIfActionViewIsNull() throws Exception {
item.setActionView(null);
assertThat(item.collapseActionView()).isFalse();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void collapseActionView_shouldInvokeListener() throws Exception {
item.setActionView(new View(ApplicationProvider.getApplicationContext()));
listener.expanded = true;
item.collapseActionView();
assertThat(listener.expanded).isFalse();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void expandActionView_shouldInvokeListener() throws Exception {
item.setActionView(new View(ApplicationProvider.getApplicationContext()));
item.expandActionView();
assertThat(listener.expanded).isTrue();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void expandActionView_shouldSetExpandedTrue() throws Exception {
item.setActionView(new View(ApplicationProvider.getApplicationContext()));
assertThat(item.expandActionView()).isTrue();
assertThat(item.isActionViewExpanded()).isTrue();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void collapseActionView_shouldSetExpandedFalse() throws Exception {
item.setActionView(new View(ApplicationProvider.getApplicationContext()));
item.expandActionView();
assertThat(item.collapseActionView()).isTrue();
assertThat(item.isActionViewExpanded()).isFalse();
}
代码示例来源:origin: robolectric/robolectric
item = item.setActionProvider(null);
assertThat(item).isNotNull();
item = item.setActionView(0);
assertThat(item).isNotNull();
item = item.setActionView(null);
assertThat(item).isNotNull();
item = item.setAlphabeticShortcut('a');
代码示例来源:origin: stackoverflow.com
// Helper methods
protected MenuItem refreshItem = null;
protected void setRefreshItem(MenuItem item) {
refreshItem = item;
}
protected void stopRefresh() {
if (refreshItem != null) {
refreshItem.setActionView(null);
}
}
protected void runRefresh() {
if (refreshItem != null) {
refreshItem.setActionView(R.layout.indeterminate_progress_action);
}
}
代码示例来源:origin: stackoverflow.com
it.setActionView(button);
mAddListingButton = it.getActionView();
return true;
代码示例来源:origin: ukanth/afwall
private void search(MenuItem item) {
item.setActionView(R.layout.searchbar);
final EditText filterText = (EditText) item.getActionView().findViewById(
R.id.searchApps);
filterText.addTextChangedListener(filterTextWatcher);
filterText.setEllipsize(TruncateAt.END);
filterText.setSingleLine();
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
// Do something when collapsed
selectFilterGroup();
return true; // Return true to collapse action view
}
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
filterText.post(() -> {
filterText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(filterText, InputMethodManager.SHOW_IMPLICIT);
});
return true; // Return true to expand action view
}
});
}
代码示例来源:origin: stackoverflow.com
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
MenuItem someMenuItem = menu.getItem(R.id.menu_option_id);
someMenuItem.setActionView(theView);
return true;
}
代码示例来源:origin: stackoverflow.com
MenuItem item = menu.add("Search");
SearchView sv = new SearchView(getActionBar().getThemedContext());
item.setActionView(sv);
item.setIcon(R.drawable.ic_search);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
| MenuItem.SHOW_AS_ACTION_IF_ROOM);
内容来源于网络,如有侵权,请联系作者删除!