java - 安卓 : is it possible to call requestFeature() after setContentView ?

标签 java android android-activity

我想在使用 setContentView() 加载 View 后调用 requestFeature(),但错误非常明显:

android.util.AndroidRuntimeException: requestFeature() must be called before adding content

没有办法直接在 Activity 中调用 requestFeature() 吗?

最佳答案

来自开发者网站关于 requestFeature() :

Enable extended screen features. This must be called before setContentView(). May be called as many times as desired as long as it is before setContentView(). If not called, no extended features will be available. You can not turn off a feature once it is requested. You canot use other title features with FEATURE_CUSTOM_TITLE.

所以简单的答案是否定的。

关于java - 安卓 : is it possible to call requestFeature() after setContentView ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24939170/

相关文章:

java - 自定义类变量在数组中时返回 null

android - 使用 Jtransform 的 DoubleFFT_1D() for android 计算 DFT

Android:将用户名保留在 session 中直到注销

java - 尽管按下后退按钮,但 Activity 仍在后台运行

java - 网 bean 7 : How to create Java project from existing source correctly?

java - Mockito:如何在when语句中传递特定的 map 作为参数?

java - JOOQ 生成器 : Missing name

java - 自定义 Android 模块中的重复条目 : org/appcelerator/titanium/gen/bindings. json

android - 如何为不同于 armeabi 的架构构建和使用 PJSIP?

android - 管理 android Activity 堆栈 : How can a specific instance of an activity bring itself to the front?