Sense-like context menus?

355 views Asked by At

I've noticed some programs use a popup toolbar for context menus instead of actual context menus, like in Sense (see image:)

enter image description here

How would I go about implementing something like that?

2

There are 2 answers

1
Shankar Agarwal On BEST ANSWER

It's called a Quick Actions Popup, you have to create it yourself.

Refer this LINK.

Sample code snippet::

//Add action item
ActionItem addAction = new ActionItem();
addAction.setTitle("Add");
addAction.setIcon(getResources().getDrawable(R.drawable.ic_add));

//Accept action item
ActionItem accAction = new ActionItem();

accAction.setTitle("Accept");
accAction.setIcon(getResources().getDrawable(R.drawable.ic_accept));

//Upload action item
ActionItem upAction = new ActionItem();
upAction.setTitle("Upload");
upAction.setIcon(getResources().getDrawable(R.drawable.ic_up));

Create quickaction instance and setup listener

final QuickAction mQuickAction  = new QuickAction(this);

mQuickAction.addActionItem(addAction);
mQuickAction.addActionItem(accAction);
mQuickAction.addActionItem(upAction);

//setup the action item click listener
mQuickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
    @Override
        public void onItemClick(int pos) {
        if (pos == 0) { //Add item selected
           Toast.makeText(Example1Activity.this, "Add item selected", Toast.LENGTH_SHORT).show();
        } else if (pos == 1) { //Accept item selected
           Toast.makeText(Example1Activity.this, "Accept item selected", Toast.LENGTH_SHORT).show();
        } else if (pos == 2) { //Upload item selected
           Toast.makeText(Example1Activity.this, "Upload items selected", Toast.LENGTH_SHORT).show();
        }
    }
});
0
K_Anas On

these links correspond to exactly your needs, by the way this popup tool is called QuickAction:

QuickAction

QuickAction Dialog

Green Droid QuickAction

QuickActionBar and GridAction

Hope this will help you