开发者

I want to make a pop up menu that allows selection of different options on android

开发者 https://www.devze.com 2023-03-27 22:11 出处:网络
I have a bitmap displa开发者_开发知识库ying some medical information and want to have an option to bring up a menu from the bottom of the bitmap which allows choosing different diagnostics, some withi

I have a bitmap displa开发者_开发知识库ying some medical information and want to have an option to bring up a menu from the bottom of the bitmap which allows choosing different diagnostics, some within sub menus.

I had thought that possibly using a sliding draw would be a good simple idea for this but I think there must be a better way to do this. I must be able to have the options clickable so that the data can be saved to a file.

Any suggestions other than using a sliding draw and buttons would be much appreciated.

Thanks.


Use the options menu of android. It can be set for each activity.

in the activity use the code

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

}

And add a menu.xml file in the menu folder of the resources folder

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/export_menubutton_id" android:title="Export" />
    <item android:id="@+id/email_menubutton_id" android:title="Email" />
    <item android:id="@+id/facebook_menubutton_id" android:title="Facebook" />  
</menu>
0

精彩评论

暂无评论...
验证码 换一张
取 消