简体   繁体   English

如何将操作栏导航下拉菜单放置在主要详细信息布局中的第二个片段上方

[英]How to position actionbar navigation dropdown menu above second fragment in master detail layout

I have master detail layout in my app (see picture on the left): 我的应用程序中有主要的细节布局(请参见左图): 在此处输入图片说明

I have navigation mode list set for actionbar (using it for filtering listview in second fragment): 我为操作栏设置了导航模式列表(使用它来过滤第二个片段中的listview):

final ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 

I removed my activity title from actionbar with: 我使用以下命令从操作栏中删除了活动标题:

actionBar.setDisplayShowTitleEnabled(false);

The problem is that my drop down menu now appears above the first fragment (on the left side of the actionbar), as if it is refering to first fragment. 问题是我的下拉菜单现在出现在第一个片段的上方(在操作栏的左侧),就好像它在引用第一个片段一样。 This might confuse the user. 这可能会使用户感到困惑。

How can i place actionbar dropdown menu above second fragment? 如何在第二个片段上方放置动作栏下拉菜单?

there's no direct API to do what you want (move the spinner to the middle of the ActionBar) 没有直接的API可以执行您想要的操作(将微调器移到ActionBar的中间)

Your best option to achieve something remotely similar to that is to create your own view with a spinner and user the setCustomView method from the actionbar. 实现与之相似的远程操作的最佳选择是使用微调器创建自己的视图,并从操作栏中使用setCustomView方法。

please use this link 请使用此链接

screen shots: 屏幕截图: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM