标签即将上述行动吧充气自定义布局时 [英] Tabs Coming above Action bar when inflating custom layout

查看:119
本文介绍了标签即将上述行动吧充气自定义布局时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在这里对所有#1的其他答案,但它不工作提到了一切。这是我的code。

 动作条= getActionBar();
actionBar.setBackgroundDrawable(新ColorDrawable(Color.parseColor(#FFFFFF)));
actionBar.setDisplayShowHomeEnabled(真正的);
actionBar.setDisplayShowCustomEnabled(真正的);
actionBar.setCustomView(R.layout.actionbar_layout);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setLogo(空);
actionBar.setDisplayShowTitleEnabled(假);
查看homeIcon = findViewById(android.R.id.home);
((查看)homeIcon.getParent())setVisibility(View.GONE)。
 

解决方案

该选项卡显示在上面,当你隐藏的主页项目。这是一个有点反直觉的,但同时也提出了一些设计感。他们基本上是轻推,你要使用标签作为标题的部分和使用操作栏下方他们为这些节内的行动。

您需要 setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME)使标签再次回落。它可能会需要一个非空的标志太(你可以做一个1px的透明之一-nodpi让它消失)

I tried everything mentioned here on all Stackoverflow's other answers but its not working out. Here is my code.

actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff")));
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(R.layout.actionbar_layout);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setLogo(null);
actionBar.setDisplayShowTitleEnabled(false);
View homeIcon = findViewById(android.R.id.home);
((View) homeIcon.getParent()).setVisibility(View.GONE);

解决方案

The tabs show on top when you hide the Home item. It is a bit counter intuitive but it also makes some design sense. They're essentially nudging you to use the tabs as titles for the sections and use the action bar below them for actions inside those sections.

You need setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME) to bring the tabs down again. It will probably need a non-null logo too (you can make a 1px transparent one in -nodpi to make it disappear)

这篇关于标签即将上述行动吧充气自定义布局时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆