my layouts have black back ground

68 views Asked by At

my layouts have black background, this problem also effects my button styles my cards in my recycle view..any body can help find the cause please? I know workarounds but I need to find the problem source..now my structure is pretty simple I have a base activity that all my activities extends

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>
1

There are 1 answers

1
Francis Nduba Numbi On BEST ANSWER

Theme.AppCompat has a default dark background.

You can change it to either Theme.AppCompat.Light

Or Theme.AppCompat. Light.DarkActionBar