2017-08-28 92 views
-2

我的佈局有黑色的背景,這個問題也影響我的按鈕樣式我的卡片在我的回收視圖..任何機構可以幫助找到原因嗎? 我知道解決方法,但我需要找到問題source..now我的結構非常簡單我有我的所有活動延伸的基本活動我的佈局有黑色背景

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> 
+0

更改主題點亮一個 –

+0

是預覽可見的工作室? –

+0

什麼是您的defalutBackgroundColor? –

回答

0

Theme.AppCompat有默認的深色背景。

您可以在編輯器中它更改爲 Theme.AppCompat.Light

或者 Theme.AppCompat. Light.DarkActionBar

+0

非常感謝,它工作得很好:) – user1935142

+0

如果我幫你或者你可以把它設置爲回答,你可以投我一票。 –