Android清单中的微小变化会导致应用崩溃

强尼

很简单,我正在更改我的android清单以删除标题栏。在styles.xml文件中,我更改了应用程序样式的父项,并在android清单中更改了android:theme。现在,但是当我在android上进行测试时,它只会显示白屏。

我的styles.xml:

<resources>

<!-- Base application theme. -->
<style name="AppTheme"
    parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

我的android_manifests:

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen">
    <activity android:name=".MainActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".ColorMatch2"
        android:screenOrientation="portrait">
    </activity>
    <activity android:name=".LoseScreen"
        android:screenOrientation="portrait">
    </activity>
</application>

</manifest>

我的MainActivity.java,可能无关紧要,但以防万一,这是罪魁祸首:

package com.example.ali.colormatch2;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;


public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

public void onSplashPageClick(View view){
    Intent intent = new Intent(MainActivity.this, ColorMatch2.class);
    startActivity(intent);
}

public void onQuitClick(View view){
    finish();
}
}

对应的activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#005825"
tools:context="com.example.ali.colormatch2.MainActivity"
android:onClick="onSplashPageClick"

android:baselineAligned="false">

<!--<Button
    android:text="Button"
    android:layout_width="159dp"
    android:layout_height="100dp"
    android:id="@+id/button5"
    android:onClick="sendMessage" />
    -->


<Button
    android:layout_width="35dp"
    android:layout_height="35dp"
    android:id="@+id/button"
    android:background="@android:drawable/btn_dialog"
    android:onClick="onQuitClick"
    android:layout_marginTop="16dp"
    android:layout_marginLeft="24dp"
    android:layout_marginStart="24dp"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<TextView
    android:text="Click anywhere to play"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/textView5"
    android:textSize="30dp"
    android:textColor="#000000"
    android:layout_marginBottom="171dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fontFamily="sans-serif-thin"
    android:text="Color Match"
    android:gravity="center"
    android:textColor="#440027"
    android:textSize="75dp"
    android:id="@+id/textView"
    android:layout_marginBottom="12dp"
    android:layout_above="@+id/textView5"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />


</RelativeLayout>

另外应该注意的是,我也在android清单中尝试了android:theme =“ @ android:style / Theme.Light.NoTitleBar”>,但这似乎也没有用。谢谢

编辑 - -

Logcat输出:

3:21:37 PM Gradle sync started
3:22:01 PM Gradle sync completed
3:22:02 PM Executing tasks: [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]
3:22:06 PM Gradle build finished in 5s 131ms
3:26:53 PM Executing tasks: [:app:assembleDebug]
3:26:58 PM Gradle build finished in 5s 281ms
3:37:53 PM Executing tasks: [:app:assembleDebug]
3:37:55 PM Gradle build finished in 2s 165ms
3:38:02 PM Performing full build and install:
       On devices with API level below 21, a full build is required if the app is not running.
       (Dont show again)
3:40:37 PM Executing tasks: [:app:assembleDebug]
3:40:40 PM Gradle build finished in 2s 187ms
3:40:47 PM Performing full build and install:
       On devices with API level below 21, a full build is required if the app is not running.
       (Dont show again)
11:15:21 PM Executing tasks: [:app:assembleDebug]
11:15:46 PM Gradle build finished in 24s 689ms
11:18:22 PM Executing tasks: [:app:assembleDebug]
11:18:27 PM Gradle build finished in 5s 487ms
11:18:34 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:19:52 PM Executing tasks: [:app:assembleDebug]
11:19:53 PM Gradle build finished in 1s 893ms
11:20:00 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:48:01 PM Executing tasks: [:app:assembleDebug]
11:48:05 PM Gradle build finished in 4s 209ms
11:48:13 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:48:52 PM Executing tasks: [:app:assembleDebug]
11:48:53 PM Gradle build finished in 1s 96ms
11:48:55 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:49:56 PM Executing tasks: [:app:assembleDebug]
11:49:58 PM Gradle build finished in 1s 735ms
11:50:05 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:52:14 PM Executing tasks: [:app:assembleDebug]
11:52:17 PM Gradle build finished in 3s 8ms
11:52:24 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:57:56 PM Executing tasks: [:app:assembleDebug]
11:58:02 PM Gradle build finished in 5s 654ms
11:58:08 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
11:59:12 PM Executing tasks: [:app:assembleDebug]
11:59:14 PM Gradle build finished in 1s 664ms
11:59:21 PM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
12:01:51 AM Executing tasks: [:app:assembleDebug]
12:01:53 AM Gradle build finished in 1s 917ms
12:01:59 AM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
12:13:12 AM Executing tasks: [:app:assembleDebug]
12:13:17 AM Gradle build finished in 5s 159ms
12:13:25 AM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
12:22:27 AM Executing tasks: [:app:assembleDebug]
12:22:32 AM Gradle build finished in 4s 708ms
12:22:39 AM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
12:23:38 AM Executing tasks: [:app:assembleDebug]
12:23:41 AM Gradle build finished in 2s 643ms
12:23:49 AM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
12:24:02 AM Executing tasks: [:app:assembleDebug]
12:24:05 AM Gradle build finished in 2s 215ms
12:24:23 AM Performing full build and install:
        On devices with API level below 21, a full build is required if the app is not running.
        (Dont show again)
12:24:23 AM Can't bind to local 8600 for debugger
瓦特坦

更改此android:theme="@android:style/Theme.Light.NoTitleBar.Fullscr‌​een"android:theme="@style/AppTheme"

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

创建googleApiClient会导致Android应用崩溃

Android:从Firebase读取对象会导致应用程序崩溃

Android:使用getResources可能会导致我的应用崩溃

在listView中创建微调框会导致应用崩溃

当我在Android Studio中的异步线程中调用Toast.makeText时,会导致应用程序崩溃吗?

在Android中启动并忘记对话框会导致崩溃

为什么线性调频频率的微小变化会导致快速傅立叶变换输出发生重大变化?

在没有数据来自Web服务的情况下显示Toast会导致Android中的应用崩溃

单击按钮会导致应用崩溃

快速投放会导致应用崩溃

添加约束会导致应用崩溃

创建片段会导致应用崩溃

延迟加载数组会导致应用崩溃

setSupportActionBar导致Android应用崩溃

事务性块会导致在db上的postgresql中错误提交或导致应用崩溃吗?

在Android中更改字体会导致应用崩溃?

在ImageView中设置Vector Drawable会导致旧SDK中的应用崩溃

按照Android Studio的建议删除多余的转义会导致应用崩溃

为什么双击自定义按钮会导致 Android 应用程序崩溃

为什么网格布局会导致 android studio 应用程序崩溃?

在布局中添加内容会导致崩溃

定义BOOST_TEST_DYN_LINK会导致应用程序在Visual Studio中崩溃

尝试在Swift中访问无主引用总是会导致应用崩溃

React Native-在Button onPress中访问“ this”会导致应用崩溃

SwiftUI:在View主体中调用修改EnvironmentObject的函数会导致无限循环和应用崩溃

C ++中双精度值的微小变化

微小的变化导致“未知”-与量词预处理有关?

Android Toast。设置重力导致应用崩溃

iTextG导致应用程序崩溃(Android)