问题标签 [android-actionbaractivity]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
12808 浏览

android - 无法删除 Activity 中的标题栏

我想删除我的活动顶部的标题。我尝试了这两种工作方式,但不是在 api 8 级。

1:

2:

知道为什么这不起作用api 8吗?

一旦我设法将其删除api 8,但我不记得如何删除它。


编辑:

解决了!问题是 this.requestWindowFeature(Window.FEATURE_NO_TITLE)在 API 8 上不起作用,也<item name="android:windowNoTitle">true</item>不起作用,但 actionBar.hide()有效,getSupportActionBar() 返回 null 的原因是之前使用了两个选项之一,我只是忘记删除两者。当我删除一个时,我添加另一个(多么愚蠢!)谢谢大家!(抱歉英语不好)

0 投票
1 回答
415 浏览

android - 操作栏项目(Action Items)未在 android 中显示。

我有两个菜单项menu/contacts_menu.xml

在哪里,在我的Fragment

我在其他应用程序中完成了相同的过程,并且正在显示操作项。但是在我当前的应用程序中,它们没有显示。仅当我按下菜单按钮时,操作项才仅显示文本。我想在我的操作栏上显示图标。

0 投票
1 回答
21766 浏览

java - Unable to change Appcompat theme from light to holo dark

I am trying to change the theme of my app completely, This is what I modified & tried :

styles.xml in values folder is

values-v11 styles.xml

values-v14 styles.xml

Mainifest.xml

I am using ActionBarActivity & appcompat_v7 but the app crashes by java.lang.RuntimeException: Unable to start activity ComponentInfo{com...}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

Am I missing something...?

How can I solve this problem?

Please help...

Thanks in advance !


EDIT: When using Appcompat theme , the theme was light, the code was:

So, using appcompat theme my styles.xml in values folder was

values-v11 styles.xml

values-v14 styles.xml

Mainifest.xml

And I dont know how to change appcompat theme from light to holo dark. Please help

0 投票
1 回答
555 浏览

android - ActionBarActivity 和 FragmentActivity 中的 setContentView

在 FragmentActivity 中,super.onCreate 和 setContentView 的顺序并不重要,为什么?

片段活动

但是在 ActionBarActivity 中,它会抛出 NullPointerException。

动作栏活动

0 投票
1 回答
115 浏览

android - Android menu items are not showing up at once

I have two menu items: Settings and Exit. When I run my code, with both set to showAsAction:"always", none of them show up on the screen when I press the menu button on my phone. This also happens if I set both to "ifRoom". However, if I set one to "never", the other one will show up. How can I get both items to show up? I am running a ~3.5 inch android 4.1.2 phone. I am using the android:theme="@style/Theme.AppCompat" theme.

This is the screen when both items are set to "always" or "ifRoom", no menu items show up: two muppets This is the screen when settings is set to "never", the exit item shows up:
ttwtw There seems to be enough room, so how do I make both items show up? Thank you.

0 投票
2 回答
1104 浏览

android - 调用 supportInvalidateOptionsMenu() 后,菜单 ActionBarActivity 不起作用;

我正在使用库并与抽屉菜单兼容。

调用supportInvalidateOptionsMenu()函数后;弹出菜单未能出现,只留下核心流程图标。

有什么解决办法吗?

在我的 ActMain 中执行此操作(非常片段的主要活动)

注意:只有一个菜单项带有子菜单。在这个子菜单中,所有项目都是可见的,但是当我单击要出现在 ActionBar 中的项目时,其他项目只会出现一次。这仅发生在 Android 2.3 版本中。在上部工作得很好。

0 投票
0 回答
247 浏览

android - 操作栏选项卡上的导航抽屉

我在我的应用程序中使用导航抽屉和操作栏选项卡,但导航抽屉位于操作栏选项卡下方。我想在操作栏选项卡布局上显示导航抽屉。有什么建议吗?我不想使用 actionbarsherlock lib。

0 投票
1 回答
1180 浏览

android - Android:图标不会出现在操作栏中

我正在关注操作栏的谷歌教程,但图标没有出现在上面,这是菜单 xml 文件:

这在我的主要活动中:

0 投票
1 回答
35 浏览

android - ActionBarActivity 抛出配置路径错误

我正在尝试在我的应用程序中构建操作栏。我有 appcompact v7 作为库项目,我也将它引用到我的项目中。我花了一整天但仍然没有得到解决方案!

这是我的 Java 构建路径窗口 在此处输入图像描述 这是我的项目导入的库 在此处输入图像描述 这是我得到的错误在此处输入图像描述

如果有人可以,请帮助。预先感谢

0 投票
0 回答
574 浏览

android - 在旋转后隐藏 DialogFragment 时获取“java.lang.IllegalStateException:活动已被破坏”

我有一个有时会显示 DialogFragment 的 ActionBarActivity。当我尝试在旋转后关闭对话框时,它会因 IllegalStateException:Activity 已被破坏而崩溃。我无法将 Activity 设置为

因为我需要在旋转时重新绘制布局。

我能做些什么?

--编辑-- 这是 logcat: