Android 操作栏是如何隐藏在这里的?
我正在看的是的演示应用程序 在its中,它使用Android 操作栏是如何隐藏在这里的?,android,Android,我正在看的是的演示应用程序 在its中,它使用AppTheme 他们的应用程序的布局渲染器中没有动作栏,但我的应用程序也有动作栏,即使设置了窗口。功能\u no\u标题。这是我的: 似乎在API 21中 this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE); 不起作用 尝试将其添加到AndroidManifest.xml文件中 android:theme="@android:style/Theme.NoTitleBar.Ful
AppTheme
他们的应用程序的布局渲染器中没有动作栏,但我的应用程序也有动作栏,即使设置了窗口。功能\u no\u标题。这是我的:
似乎在API 21中
this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
不起作用
尝试将其添加到AndroidManifest.xml文件中
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
或者加上这个
this.getActionBar().hide();
在super.onCreate(savedInstanceState)之后的onCreate方法中 通过在活动中获取actionbar的实例并将其隐藏在那里?我看不到在活动中会发生这种情况。请发布相关代码好吗?例如,您的MainActivity.java?他们从未创建过ActionBar,因此不需要隐藏它。第30行:requestWindowFeature(Window.FEATURE\u NO\u TITLE);试试这个。看起来很奇怪,所以我刚刚创建了一个新项目来做一些测试。将requestWindowFeatures(Window.FEATURE\u NO\u TITLE)添加到onCreate as第一行中会为我删除标题栏。我实际上使用的是API 22。问题是,它们似乎没有这些线条,但它们的条形图不会显示在布局渲染器中。对我来说,即使设置了Window.FEATURE\u NO\u TITLE
,它也会显示在渲染器中。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tagapp.tagapp" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 22
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.tagapp.tagapp"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
this.getActionBar().hide();