android.view.MenuItem.isActionViewExpanded()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中android.view.MenuItem.isActionViewExpanded()方法的一些代码示例,展示了MenuItem.isActionViewExpanded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.isActionViewExpanded()方法的具体详情如下:
包路径:android.view.MenuItem
类名称:MenuItem
方法名:isActionViewExpanded

暂无

代码示例

代码示例来源:origin: square/assertj-android

@TargetApi(ICE_CREAM_SANDWICH)
public MenuItemAssert isActionViewExpanded() {
 isNotNull();
 assertThat(actual.isActionViewExpanded()) //
   .overridingErrorMessage("Expected expanded action view but action view was collapsed.") //
   .isTrue();
 return this;
}

代码示例来源:origin: square/assertj-android

@TargetApi(ICE_CREAM_SANDWICH)
public MenuItemAssert isActionViewCollapsed() {
 isNotNull();
 assertThat(actual.isActionViewExpanded()) //
   .overridingErrorMessage("Expected collapsed action view but action view was expanded.") //
   .isFalse();
 return this;
}

代码示例来源: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: ankidroid/Anki-Android

mToolbarAddItem.setOnMenuItemClickListener(menuItem -> {
  String query = mToolbarSearchView.getQuery().toString();
  if (mToolbarSearchItem.isActionViewExpanded() && !TextUtils.isEmpty(query)) {
    addTag(query);
    mToolbarSearchView.setQuery("", true);

代码示例来源:origin: ukanth/afwall

@Override
public boolean onSearchRequested() {
  MenuItem menuItem = mainMenu.findItem(R.id.menu_search); // R.string.search is the id of the searchview
  if (menuItem != null) {
    if (menuItem.isActionViewExpanded()) {
      menuItem.collapseActionView();
    } else {
      menuItem.expandActionView();
      search(menuItem);
    }
  }
  return super.onSearchRequested();
}

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public boolean isActionViewExpanded() {
  return mNativeItem.isActionViewExpanded();
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public boolean isActionViewExpanded() {
  return mNativeItem.isActionViewExpanded();
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static boolean isActionViewExpanded(MenuItem item) {
  return item.isActionViewExpanded();
}

代码示例来源:origin: MuShare/Httper-Android

@Override
  public void onBackPressed() {
    if (menuItemSearch != null && menuItemSearch.isActionViewExpanded())
      menuItemSearch.collapseActionView();
    else super.onBackPressed();
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

@TargetApi(ICE_CREAM_SANDWICH)
public MenuItemAssert isActionViewCollapsed() {
 isNotNull();
 assertThat(actual.isActionViewExpanded()) //
   .overridingErrorMessage("Expected collapsed action view but action view was expanded.") //
   .isFalse();
 return this;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

@TargetApi(ICE_CREAM_SANDWICH)
public MenuItemAssert isActionViewExpanded() {
 isNotNull();
 assertThat(actual.isActionViewExpanded()) //
   .overridingErrorMessage("Expected expanded action view but action view was collapsed.") //
   .isTrue();
 return this;
}

代码示例来源:origin: billthefarmer/diary

@Override
public boolean onPrepareOptionsMenu(Menu menu)
{
  Calendar today = GregorianCalendar.getInstance();
  menu.findItem(R.id.today).setEnabled(currEntry == null ||
                     currEntry.get(Calendar.YEAR) !=
                     today.get(Calendar.YEAR) ||
                     currEntry.get(Calendar.MONTH) !=
                     today.get(Calendar.MONTH) ||
                     currEntry.get(Calendar.DATE) !=
                     today.get(Calendar.DATE));
  menu.findItem(R.id.nextEntry).setEnabled(nextEntry != null);
  menu.findItem(R.id.prevEntry).setEnabled(prevEntry != null);
  menu.findItem(R.id.index).setVisible(useIndex);
  // Show find all item
  if (menu.findItem(R.id.search).isActionViewExpanded())
    menu.findItem(R.id.findAll).setVisible(true);
  else
    menu.findItem(R.id.findAll).setVisible(false);
  return true;
}

代码示例来源:origin: cbeyls/fosdem-companion-android

@Override
protected void onStop() {
  if ((searchMenuItem != null) && searchMenuItem.isActionViewExpanded()) {
    searchMenuItem.collapseActionView();
  }
  super.onStop();
}

代码示例来源:origin: stackoverflow.com

private Menu ABSMenu;

@Override

public boolean onCreateOptionsMenu(Menu menu) {
  ABSMenu = menu;
  return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onSearchRequested() {

  MenuItem mi = ABSMenu.findItem(R.string.search); // R.string.search is the id of the searchview
  if(mi!=null){
  if(mi.isActionViewExpanded())
   {
      mi.collapseActionView();
   }else 
   {
      mi.expandActionView();  
   }
  }

  return super.onSearchRequested();
}

代码示例来源:origin: billthefarmer/diary

if (searchItem.isActionViewExpanded())
  searchItem.collapseActionView();
if (searchItem.isActionViewExpanded())
  searchItem.collapseActionView();

代码示例来源:origin: stackoverflow.com

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
  MenuItem mi = mMenu.findItem(R.id.search);
  if(mi.isActionViewExpanded()){
    mi.collapseActionView();
  } else{

代码示例来源:origin: billthefarmer/diary

if (searchItem.isActionViewExpanded() &&
    item.getItemId() != R.id.findAll)
  searchItem.collapseActionView();

代码示例来源:origin: stackoverflow.com

public boolean onMenuItemActionCollapse(MenuItem item) {
  if (mSearchItem.isActionViewExpanded()) {
    animateSearchToolbar(1, false, false);

代码示例来源:origin: billthefarmer/editor

if (searchItem.isActionViewExpanded())
  searchItem.collapseActionView();

相关文章