Android studio Android Studio不应用我的设计更改
我试图通过删除动作栏或更改其标题来更改某些活动的主题。起初,我是使用设计选项卡中的AppTheme选项来完成的。然而,在网上搜索之后,我知道我的做法是错误的,所以我转到AndroidManifest文件手动进行更改。不幸的是,它也不起作用。以下是我的清单文件的代码:Android studio Android Studio不应用我的设计更改,android-studio,kotlin,manifest,Android Studio,Kotlin,Manifest,我试图通过删除动作栏或更改其标题来更改某些活动的主题。起初,我是使用设计选项卡中的AppTheme选项来完成的。然而,在网上搜索之后,我知道我的做法是错误的,所以我转到AndroidManifest文件手动进行更改。不幸的是,它也不起作用。以下是我的清单文件的代码: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.wonderheart">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:label="Sign Up"/>
<activity
android:name=".Login"
android:label="Log In"/>
<activity android:name=".drawable.welcome">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".UserProfile"
android:theme="@style/AppTheme.NoActionBar"/>
<activity android:name=".HomePage" >
</activity>
</application>
</manifest>
我正在使用Android Studio 3.0预览版和Kotlin。我希望你能帮助我,因为如果不解决这个设计问题,我的工作就无法取得进展 您可以用两种方法解决问题。
1.对所有活动使用公共一个主题,并在onCreate方法中使用代码隐藏和显示操作栏
// Set up the toolbar
val toolbar = findViewById(R.id.toolbar) as Toolbar
setSupportActionBar(toolbar)
var actionBar = supportActionBar
//For hiding android actionbar
actionBar.hide();
//For showing android actionbar
//actionBar.show();
在活动中使用自定义样式,在下面的示例中,您不想显示操作栏。我是在应用程序级别使用自定义样式的,但您可以在任何其他活动中使用自定义样式
style.xml
<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>
</resources>
<application
android:allowBackup = "true"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/NoActionBar" <!--This is the important line-->
>
<activity
假的
真的
AndroidManifest.xml
<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>
</resources>
<application
android:allowBackup = "true"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/NoActionBar" <!--This is the important line-->
>
<activity
你们可以用两种方法解决这个问题。
1.对所有活动使用公共一个主题,并在onCreate方法中使用代码隐藏和显示操作栏
// Set up the toolbar
val toolbar = findViewById(R.id.toolbar) as Toolbar
setSupportActionBar(toolbar)
var actionBar = supportActionBar
//For hiding android actionbar
actionBar.hide();
//For showing android actionbar
//actionBar.show();
在活动中使用自定义样式,在下面的示例中,您不想显示操作栏。我是在应用程序级别使用自定义样式的,但您可以在任何其他活动中使用自定义样式
style.xml
<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>
</resources>
<application
android:allowBackup = "true"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/NoActionBar" <!--This is the important line-->
>
<activity
假的
真的
AndroidManifest.xml
<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>
</resources>
<application
android:allowBackup = "true"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/NoActionBar" <!--This is the important line-->
>
<activity