Android Studio Activity主题导致崩溃

时间:2015-01-20 19:30:21

标签: android xml android-manifest

我花了很长时间在论坛上看看如何更改Android应用开发活动的主题。

我的主要目标是删除标题栏。但是仍然想知道如何改变主题。

我尝试使用Android Studio内置的GUI更改主题...预览中的主题发生了变化,但是当我在手机上运行应用程序时没有任何变化。

所以我想我会使用Manifest文件中的一些xml代码更改主题。

每个人似乎都在做以下事情:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dennis.activeapp" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"

        <!--  HERE IS WHERE I SET THE THEME  -->

        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

        <activity  
            android:name=".MainActivity"
            android:label="@string/app_name" >    
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />   
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".SecActivity"
            android:label="@string/title_activity_sec" >
        </activity>
        <activity
            android:name=".FirActivity"
            android:label="@string/title_activity_fir" >
        </activity>
    </application>

</manifest>

以上是我的代码。

现在,当我尝试在手机上运行时,应用程序崩溃了。应用程序打开几分之一秒然后关闭。

如果有任何帮助我的手机是Cubot S208。因为我觉得问题可能不是代码,因为我直接跟随人们在之前的帖子/论坛中所说的内容。

我在ADB日志中收到的错误消息如下:

ddms: null
java.lang.NullPointerException
    at com.android.ddmlib.Client.read(Client.java:731)
    at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:311)
    at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)

PropertyFetcher: AdbCommandRejectedException getting properties for device     0123456789ABCDEF: device unauthorized. Please check the confirmation dialog on     your device.
PropertyFetcher: AdbCommandRejectedException getting properties for device     0123456789ABCDEF: device unauthorized. Please check the confirmation dialog on     your device.

但我确信这是导致此问题的评论(主题)下方的代码。没有它,我没有崩溃!

0 个答案:

没有答案