user4928488
user4928488

Reputation:

Android: custom action menu item from bottom

I am trying to create an action menu item from bottom like whatsapp.In whatsapp the menu item is shown as white background and its shows as a drop down list item.

menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context="com.frendytalk.AboutPage">
<item android:id="@+id/action_account"
    android:title="My Account"
    android:orderInCategory="100"
    app:showAsAction="always" />

<item android:id="@+id/action_checkRates"
    android:title="Check Rates"
    android:orderInCategory="100"
    app:showAsAction="always" />
<item android:id="@+id/action_voucher"
    android:title="Redeem Voucher"
    android:orderInCategory="100"
    app:showAsAction="always" />
<item android:id="@+id/action_about"
    android:title="About"
    android:orderInCategory="100"
    app:showAsAction="always" />
<item android:id="@+id/action_logout"
    android:title="Logout"
    android:orderInCategory="100"
    app:showAsAction="always" />

Can any one please tell me how to make menu item shown from the bottom as custom background and as a list item

Thanks in advance :)

Upvotes: 0

Views: 422

Answers (1)

Shubhank Gupta
Shubhank Gupta

Reputation: 863

You can use ListPopupWindow for ListView by button

 ListPopupWindow popup = new ListPopupWindow(SomeActivity.this);
 popup.setAdapter(new ArrayAdapter(SomeActivity.this,R.layout.list_item, someSettings));
 popup.setAnchorView(settingsButton);
 popup.setWidth(300);
 popup.setHeight(400);

 popup.setModal(true);
 popup.setOnItemClickListener(SomeActivity.this);
 settingsButton.setOnClickListener(new OnClickListener() {
 public void onClick(View v) {
    popup.show();
}
});

For more reference you can refer http://developer.android.com/reference/android/widget/ListPopupWindow.html

If i understand your question correctly then i think this link will help you

https://android-arsenal.com/details/1/1044

It might be help you. Good Luck enter image description here

Upvotes: 1

Related Questions