Display a contextmenu when clicking a tab, in the

2019-09-15 01:57发布

I need to display something like a context menu when a certain tab is pressed, something like this : enter image description here

Is it possible? I know that when a tab is declared it must be set an Intent, and I want to display this context menu in the same screen with the tabs (the same activity). Need some help. Any idea is welcome. Thanks in advance.

EDIT : I want to say that the last tab to be something like this :

enter image description here

on Facebook. The last tab to have some options but the content to not be modified.

1条回答
再贱就再见
2楼-- · 2019-09-15 02:04

As according to your reqiurement as u only want contex menu at Tab not other data for that tab than u there is no need to add intent type for that tab or comment that intent for that tab example like

// intent = new Intent().setClass(this, tabactivity3.class);
 spec = tabHost.newTabSpec("songs").setIndicator("Search",
                       res.getDrawable(R.drawable.act3))
                   .setContent(intent);

     tabHost.addTab(spec);

i have commented intent for tab 3 which will show context menu on behind view as previous tab data as shown image below where my ic_launcher image display is of tab 1enter image description here

查看更多
登录 后发表回答