我的布局有黑色背景

my layouts have black back ground

我的布局有黑色背景,这个问题也影响我的按钮样式我的回收视图中的卡片..任何人都可以帮助找到原因吗? 我知道变通方法,但我需要找到问题根源..现在我的结构非常简单我有一个基础 activity 我所有的活动都扩展

all layouts backgrounds

activity_base.xml

    <LinearLayout
        style="@style/AppTheme.MyAppTheme"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/activity_base_toolbar"
            style="@style/ToolBarTheme"
            android:layout_width="match_parent"
            android:layout_height="?actionBarSize"></android.support.v7.widget.Toolbar>

        <FrameLayout
            android:id="@+id/activity_base_frame_layout"
            style="@style/AppTheme.MyAppTheme"
            android:layout_width="match_parent"
            android:layout_height="match_parent"></FrameLayout>
    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/activity_base_navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/colorPrimaryDark2"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.MyAppTheme"
        app:headerLayout="@layout/nav_header"
        app:menu="@menu/menu_base"></android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>

AndroidManifest.xml

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

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

    <uses-feature
        android:name="android.hardware.bluetooth_le"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher_bluetooth"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_bluetooth_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.MyAppTheme">


        <activity
            android:name=".activities.MainActivity"
            android:label="MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".activities.BondedDevicesActivity"
            android:label="@string/title_activity_bonded_devices"
            android:parentActivityName=".activities.MainActivity"
            android:theme="@style/AppTheme.MyAppTheme" />

        <activity
            android:name=".activities.ScanActivity"
            android:label="Scan Activity"
            android:parentActivityName=".activities.BondedDevicesActivity" />

        <activity
            android:name=".activities.MyDeviceActivity"
            android:label="Device Detail Activity"
            android:parentActivityName=".activities.ScanActivity" />

        <activity
            android:name=".activities.TestActivity"
            android:parentActivityName=".activities.MainActivity"></activity>

        <service
            android:name="services.MonitorService"
            android:label="Monitoring Service"></service>

        <receiver android:name="recievers.MonitorServiceReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
    </application>

</manifest>

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:textColor">@color/blueGrey</item>
        <item name="android:buttonStyle">@style/AppTheme.Button2</item>
        <item name="android:color">@color/white</item>
    </style>

    <style name="AppTheme.MyAppTheme">
        <item name="colorPrimary">@color/colorPrimary2</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark2</item>
        <item name="colorAccent">@color/colorPrimary2</item>
    </style>

    <style name="buttonStyle" parent="Widget.AppCompat.Button">
        <item name="android:textColor">@color/white</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="ToolBarTheme" parent="ToolBarTheme">
        <item name="android:background">@color/colorPrimary2</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    <style name="AppTheme.Button" parent="Widget.AppCompat.Button.Colored">
        <item name="android:colorButtonNormal">@color/brown</item>
        <item name="android:textColor">@color/white</item>
    </style>

    <style name="AppTheme.Button2" parent="Widget.AppCompat.Button.Colored">
        <item name="android:colorButtonNormal">@color/blueGrey</item>
        <item name="android:textColor">@color/white</item>
    </style>

    <style name="MyCard" parent="CardView.Dark">
        <item name="cardBackgroundColor">#311b92</item>
        <item name="android:textColor">@color/colorPrimaryDark2</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="AlertDialogCustom" parent="@android:style/Theme.Dialog">
        <item name="android:background">@color/colorLight</item>
    </style>


</resources>

Theme.AppCompat 具有默认的深色背景。

您可以将其更改为 Theme.AppCompat.Light

或者 Theme.AppCompat. Light.DarkActionBar