當前位置: 首頁>>代碼示例>>Java>>正文


Java MenuItem類代碼示例

本文整理匯總了Java中com.yydcdut.sdlv.MenuItem的典型用法代碼示例。如果您正苦於以下問題:Java MenuItem類的具體用法?Java MenuItem怎麽用?Java MenuItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MenuItem類屬於com.yydcdut.sdlv包,在下文中一共展示了MenuItem類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initListView

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
private void initListView() {
    Menu menu = new Menu(new ColorDrawable(Color.WHITE), true);
    menu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_width) * 3 / 2)
            .setBackground(new ColorDrawable(getResources().getColor(R.color.red_colorPrimary)))
            .setText(getResources().getString(R.string.delete))
            .setTextColor(Color.WHITE)
            .setTextSize((int) getResources().getDimension(R.dimen.txt_small) / 2)
            .build());
    menu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_width) * 3 / 2)
            .setBackground(new ColorDrawable(getResources().getColor(R.color.fab_blue)))
            .setText(getResources().getString(R.string.rename))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize((int) getResources().getDimension(R.dimen.txt_small) / 2)
            .build());
    mListView.setMenu(menu);
    mListView.setAdapter(mCategoryAdapter);
    mListView.setOnSlideListener(this);
    mListView.setOnMenuItemClickListener(this);
    mListView.setOnItemDeleteListener(this);
}
 
開發者ID:fanwucoder,項目名稱:mvpChat,代碼行數:22,代碼來源:EditCategoryActivity.java

示例2: onMenuItemClick

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
@Override
public int onMenuItemClick(View v, int itemPosition, int buttonPosition, int direction) {
    toast("onMenuItemClick   itemPosition--->" + itemPosition + "  buttonPosition-->" + buttonPosition + "  direction-->" + direction);
    switch (direction) {
        case MenuItem.DIRECTION_LEFT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_NOTHING;
                case 1:
                    return Menu.ITEM_SCROLL_BACK;
            }
            break;
        case MenuItem.DIRECTION_RIGHT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_SCROLL_BACK;
                case 1:
                    return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
            }
    }
    return Menu.ITEM_NOTHING;
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:23,代碼來源:SlideAndDragListViewActivity.java

示例3: initMenu

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
public void initMenu() {
    mMenuList = new ArrayList<>();
    Menu menu0 = new Menu(true, 0);
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.RED))
            .setText("Normal")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(new ColorDrawable(Color.GREEN))
            .setText("Normal")
            .setDirection(MenuItem.DIRECTION_LEFT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    Menu menu1 = new Menu(false, 1);
    Menu menu2 = new Menu(false, 2);
    mMenuList.add(menu0);
    mMenuList.add(menu1);
    mMenuList.add(menu2);
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:24,代碼來源:HeaderFooterViewTypeActivity.java

示例4: onMenuItemClick

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
@Override
public int onMenuItemClick(View v, int itemPosition, int buttonPosition, int direction) {
    switch (direction) {
        case MenuItem.DIRECTION_LEFT:
            return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
        case MenuItem.DIRECTION_RIGHT:
            showRenameDialog(itemPosition);
            return Menu.ITEM_SCROLL_BACK;
    }
    return Menu.ITEM_NOTHING;
}
 
開發者ID:fanwucoder,項目名稱:mvpChat,代碼行數:12,代碼來源:EditCategoryActivity.java

示例5: onOptionsItemSelected

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            mEditCategoryPresenter.doJob();
            break;
    }
    return true;
}
 
開發者ID:fanwucoder,項目名稱:mvpChat,代碼行數:10,代碼來源:EditCategoryActivity.java

示例6: onMenuItemClick

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
@Override
public int onMenuItemClick(View v, int itemPosition, int buttonPosition, int direction) {
	Log.i("sheldon", "onMenuItemClick   " + itemPosition + "   " + buttonPosition + "   " + direction);
	switch (direction) {
	case MenuItem.DIRECTION_RIGHT:
		switch (buttonPosition) {
		case 0://刪除該項
			return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
		}
	}
	return Menu.ITEM_NOTHING;
}
 
開發者ID:cckevincyh,項目名稱:C.,代碼行數:13,代碼來源:AtyList.java

示例7: clickMenuBtn0

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
private int clickMenuBtn0(int buttonPosition, int direction) {
    switch (direction) {
        case MenuItem.DIRECTION_RIGHT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
                case 1:
                    return Menu.ITEM_NOTHING;
                case 2:
                    return Menu.ITEM_SCROLL_BACK;
            }
    }
    return Menu.ITEM_NOTHING;
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:15,代碼來源:DifferentMenuActivity.java

示例8: clickMenuBtn1

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
private int clickMenuBtn1(int buttonPosition, int direction) {
    switch (direction) {
        case MenuItem.DIRECTION_LEFT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_SCROLL_BACK;
                case 1:
                    return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
            }
            break;
    }
    return Menu.ITEM_NOTHING;
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:14,代碼來源:DifferentMenuActivity.java

示例9: initMenu

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
public void initMenu() {
    mMenu = new Menu(true);
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) * 2)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left0))
            .setText("One")
            .setTextColor(Color.GRAY)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left1))
            .setText("Two")
            .setTextColor(Color.BLACK)
            .setTextSize((14))
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) + 30)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right0))
            .setText("Three")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right1))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setIcon(getResources().getDrawable(R.drawable.ic_launcher))
            .build());
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:28,代碼來源:SlideAndDragListViewActivity.java

示例10: onOptionsItemSelected

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_drag:
            if (item.getTitle().toString().startsWith("Enable")) {
                mListView.setOnDragDropListener(this);
                item.setTitle("Disable Drag");
            } else {
                mListView.setOnDragDropListener((SlideAndDragListView.OnDragDropListener) null);
                item.setTitle("Enable Drag");
            }
            break;
        case R.id.menu_item_click:
            if (item.getTitle().toString().startsWith("Enable")) {
                mListView.setOnItemClickListener(this);
                item.setTitle("Disable Item Click");
            } else {
                mListView.setOnItemClickListener(null);
                item.setTitle("Enable Item Click");
            }
            break;
        case R.id.menu_item_long_click:
            if (item.getTitle().toString().startsWith("Enable")) {
                mListView.setOnItemLongClickListener(this);
                item.setTitle("Disable Item Long Click");
            } else {
                mListView.setOnItemLongClickListener(null);
                item.setTitle("Enable Item Long Click");
            }
            break;
        case R.id.menu_item_close_menu:
            mListView.closeSlidedItem();
            break;
        case R.id.menu_item_delete_menu:
            mListView.deleteSlideItem();
            break;
    }
    return true;
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:40,代碼來源:SlideAndDragListViewActivity.java

示例11: initMenu

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
public void initMenu() {
    mMenu = new Menu(true);
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) * 2)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left0))
            .setText("One")
            .setTextColor(Color.GRAY)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left1))
            .setText("Two")
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) + 30)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right0))
            .setText("Three")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right1))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setIcon(getResources().getDrawable(R.drawable.ic_launcher))
            .setText("Four")
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:31,代碼來源:HeaderFooterActivity.java

示例12: initMenu

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
public void initMenu() {
    mMenu = new Menu(true);
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) * 2)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left0))
            .setText("One")
            .setTextColor(Color.GRAY)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left1))
            .setText("Two")
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) + 30)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right0))
            .setText("Three")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right1))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setIcon(getResources().getDrawable(R.drawable.ic_launcher))
            .build());
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:28,代碼來源:ItemDragActivity.java

示例13: initViews

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
	private void initViews(){
		//綁定資源
		etSearch=(EditText) findViewById(R.id.aty_list_et_search);
//		menu=(SatelliteMenu) findViewById(R.id.menu);
		bfButton=(ButtonFloat) findViewById(R.id.buttonFloat);
		biButton=(ButtonIcon) findViewById(R.id.aty_list_btn_buttonIcon);
		mListView=(SlideAndDragListView) findViewById(R.id.aty_list_listview);
		
		
		//初始化監聽器
		bfButton.setOnClickListener(this);
		biButton.setOnClickListener(this);
		etSearch.addTextChangedListener(filterTextWatcher);





		//初始化滑動刪除部分
		mMenu = new Menu((int) getResources().getDimension(R.dimen.slv_item_height), new ColorDrawable(Color.LTGRAY), false);

		MenuItem builder1 = new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width)*2)
				.setBackground(new ColorDrawable(Color.RED))
				.setText("刪除")
				.setDirection(MenuItem.DIRECTION_RIGHT)
				.setTextColor(Color.WHITE)
				.setTextSize((int) getResources().getDimension(R.dimen.txt_size))
				.build();

		mMenu.addItem(builder1);

		//初始化notesList和adapter,notesList從數據庫裏取
		getAllDataFromDatabase();
		adapter=new MyAdapter(this,notesList);

		mListView.setMenu(mMenu);
		mListView.setAdapter(adapter);
		mListView.setOnSlideListener(this);
		mListView.setOnListItemLongClickListener(this);
		mListView.setOnListItemClickListener(this);
		mListView.setOnMenuItemClickListener(this);
		mListView.setOnItemDeleteListener(this);

	}
 
開發者ID:cckevincyh,項目名稱:C.,代碼行數:46,代碼來源:AtyList.java

示例14: initMenu

import com.yydcdut.sdlv.MenuItem; //導入依賴的package包/類
public void initMenu() {
    mMenuList = new ArrayList<>();
    Menu menu0 = new Menu(true, 0);
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.RED))
            .setText("ViewType 0")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(new ColorDrawable(Color.GREEN))
            .setText("No Left")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.GRAY))
            .setText("More")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    Menu menu1 = new Menu(false, 1);
    menu1.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.RED))
            .setText("ViewType 1")
            .setDirection(MenuItem.DIRECTION_LEFT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu1.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.GRAY))
            .setText("No Right")
            .setDirection(MenuItem.DIRECTION_LEFT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    Menu menu2 = new Menu(false, 2);
    mMenuList.add(menu0);
    mMenuList.add(menu1);
    mMenuList.add(menu2);
}
 
開發者ID:yydcdut,項目名稱:SlideAndDragListView,代碼行數:45,代碼來源:DifferentMenuActivity.java


注:本文中的com.yydcdut.sdlv.MenuItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。