当前位置: 首页>>代码示例>>Java>>正文


Java MenuItem.setActionView方法代码示例

本文整理汇总了Java中android.view.MenuItem.setActionView方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setActionView方法的具体用法?Java MenuItem.setActionView怎么用?Java MenuItem.setActionView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.MenuItem的用法示例。


在下文中一共展示了MenuItem.setActionView方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if(loaderId == DELETED_LOADER_ID){
        inflater.inflate(R.menu.menu_fragment_bin, menu);
    }

    // Place an action bar item for searching.
    MenuItem item = menu.add("Search");
    item.setIcon(R.drawable.ic_search_white_24dp);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM|MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

    searchView = new SearchView(myActivity);
    searchView.setMaxWidth(Integer.MAX_VALUE);

    // Set searchbox text to white
    EditText searchEditText = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
    searchEditText.setTextColor(ContextCompat.getColor(getContext(), R.color.white));
    searchEditText.setHintTextColor(ContextCompat.getColor(getContext(), R.color.white));

    searchView.setOnQueryTextListener(this);
    item.setActionView(searchView);
    super.onCreateOptionsMenu(menu, inflater);

}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:25,代码来源:ToduleListFragment.java

示例2: onCreateOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu (Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    MenuItem item = menu.findItem(R.id.action_enable);
    item.setActionView(R.layout.switch_layout);
    SwitchCompat mSwitchEnablePush = item.getActionView().findViewById(R.id.switchForActionBar);
    mSwitchEnablePush.setChecked(PushController.isAllEnable(this));
    mSwitchEnablePush.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            PushController.setAllEnable(b, MainActivity.this);
            Toast.makeText(MainActivity.this,
                    b ? R.string.msg_enable : R.string.msg_disable
                    , Toast.LENGTH_SHORT).show();
        }
    });
    return true;
}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:19,代码来源:MainActivity.java

示例3: add

import android.view.MenuItem; //导入方法依赖的package包/类
public MenuItem add(Drawable icon, BadgeStyle style, int badgeCount, ActionItemBadge.ActionItemBadgeListener listener) {
    MenuItem item;
    if (groupId != null && itemId != null && order != null) {
        item = menu.add(groupId, itemId, order, title);
    } else {
        item = menu.add(title);
    }

    if (showAsAction != null) {
        item.setShowAsAction(showAsAction);
    }

    item.setActionView(style.getLayout());
    ActionItemBadge.update(activity, item, icon, style, badgeCount, listener);
    return item;
}
 
开发者ID:OmarAliSaid,项目名称:android-paypal-example,代码行数:17,代码来源:ActionItemBadgeAdder.java

示例4: setRefreshActionButtonState

import android.view.MenuItem; //导入方法依赖的package包/类
public void setRefreshActionButtonState(final boolean refreshing) {
    if (mOptionsMenu != null) {
        final MenuItem refreshItem = mOptionsMenu.findItem(R.id.get_opencellid);
        if (refreshItem != null) {
            if (refreshing) {
                refreshItem.setActionView(R.layout.actionbar_indeterminate_progress);
            } else {
                refreshItem.setActionView(null);
            }
        }
    }
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:13,代码来源:MapFragment.java

示例5: onOptionsItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case R.id.action_save:
            ownerId = spinnerProjectUsers.getSelectedItemPosition();
            if (spinnerProjectUsers.getSelectedItemPosition() != 0) {
                for (Enumeration<Integer> iter = projectUsers.keys(); iter.hasMoreElements();) {
                    Integer key = iter.nextElement();
                    if (projectUsers.get(key).contentEquals((String) spinnerProjectUsers.getSelectedItem())) {
                        ownerId = key;
                        break;
                    }
                }
            }
            if (isNewTask) {
                kanboardAPI.createTask(editTextTitle.getText().toString(), projectid, colorId != null ? colorId : defaultColor, columnId, ownerId, null, dueDate, editTextDescription.getText().toString(), null, null, swimlaneId, null, null, null, null, null, null, null, startDate);

            } else {
                kanboardAPI.updateTask(task.getId(), editTextTitle.getText().toString(), colorId != null ? colorId : defaultColor, ownerId, dueDate, editTextDescription.getText().toString(), null, null, null, null, null, null, null, null, null, startDate);
            }
            ProgressBar prog = new ProgressBar(TaskEditActivity.this);
            prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY);
            item.setActionView(prog);
            item.expandActionView();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:andresth,项目名称:Kandroid,代码行数:34,代码来源:TaskEditActivity.java

示例6: onCreateOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    MenuItem IndexFolderMenuItem = menu.add(0, R.string.add_to_indexed_folders, Menu.NONE, R.string.add_to_indexed_folders);
    IndexFolderMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_IF_ROOM);
    IndexFolderMenuItem.setActionView(mIndexFolderActionView);

    menu.add(0, R.string.remove_from_indexed_folders, Menu.NONE, R.string.remove_from_indexed_folders)
            .setIcon(R.drawable.ic_menu_video_unindex)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_IF_ROOM);
    menu.add(0, R.string.rescan, Menu.NONE, R.string.rescan);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:13,代码来源:BrowserByNetwork.java

示例7: onCreateOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    boolean ret = super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.cast_menu, menu);
    if(ArchosVideoCastManager.isCastAvailable()) {
        mMediaRouteMenuItem = VideoCastManager.getInstance().addMediaRouterButton(menu, R.id.media_route_menu_item);
        showOverlay();
        VideoCastManager.getInstance().addVideoCastConsumer(new VideoCastConsumerImpl() {
            @Override
            public void onCastAvailabilityChanged(boolean castPresent) {
                if (castPresent) {
                    showOverlay();
                }
            }
        });
    }
    /// /setHomeButtonsetHomeButton();
    MenuItem item = menu.add(MENU_SEARCH_GROUP, MENU_SEARCH_ITEM, Menu.NONE, R.string.search_title);
    item.setIcon(android.R.drawable.ic_menu_search);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mSearchView = new SearchView(this);
    mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    item.setActionView(mSearchView);
    mSearchItem = item;
    MenuItem menuItem = menu.add(MENU_SCRAPER_GROUP, MENU_START_AUTO_SCRAPER_ACTIVITY, Menu.NONE,
            R.string.start_auto_scraper_activity);
    menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    MenuItemCompat.setActionProvider(menuItem, mNewVideosActionProvider);
    mNewVideosActionProvider.manageVisibility(menuItem);

    menuItem = menu.add(MENU_PRIVATE_MODE_GROUP, MENU_PRIVATE_MODE_ITEM, Menu.CATEGORY_SECONDARY, R.string.activate_private_mode);
    menuItem.setIcon(R.drawable.ic_menu_private_mode);
    menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    return ret;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:39,代码来源:MainActivity.java

示例8: setRefreshActionButtonState

import android.view.MenuItem; //导入方法依赖的package包/类
public void setRefreshActionButtonState(MenuItem refreshItem, final boolean refreshing) {
    //final MenuItem refreshItem = findViewById(R.id.action_refresh);
    if (refreshItem != null) {
        if (refreshing) {
            refreshItem.setActionView(R.layout.actionbar_indeterminate_progress);
        } else {
            refreshItem.setActionView(null);
        }
    }
}
 
开发者ID:anuragsai97,项目名称:Library-Token-Automation,代码行数:11,代码来源:MainActivity.java

示例9: setActionView

import android.view.MenuItem; //导入方法依赖的package包/类
public static MenuItem setActionView(MenuItem item, View view) {
    return item.setActionView(view);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:MenuItemCompatHoneycomb.java


注:本文中的android.view.MenuItem.setActionView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。