當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。