嗨,在我的android工作室项目中,这总是红色的:@ style / ThemeOverlay.AppCompat.Dark.ActionBar
和此:
@风格/ ThemeOverlay.AppCompat.Dark.ActionBar
我已尝试过一切,但现在仍能解决这个问题。请帮帮我
和styles.xml是
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- 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="colorControlNormal">@color/lightBorder</item>
</style>
<style name="deafultSpinner" parent="android:Widget.TextView.SpinnerItem">
<item name="android:padding">0dp</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!-- new -->
<style name="logo_img">
<item name="android:src">@drawable/logo</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">@dimen/logo_width</item>
<item name="android:layout_height">@dimen/logo_height</item>
</style>
<style name="logo_tv">
<item name="android:layout_marginTop">25dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">@dimen/logo_text</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:text">RhythmCor</item>
</style>
<style name="logo_img2">
<item name="android:layout_marginTop">50dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">@dimen/logo_width</item>
<item name="android:layout_height">@dimen/logo_height</item>
<item name="android:src">@drawable/logo</item>
</style>
<style name="logo_img3">
<item name="android:layout_marginTop">100dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">@dimen/logo_width</item>
<item name="android:layout_height">@dimen/logo_height</item>
<item name="android:src">@drawable/logo</item>
</style>
<style name="status_img">
<item name="android:layout_marginTop">100dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">@dimen/statusIcon_width</item>
<item name="android:layout_height">@dimen/statusIcon_height</item>
</style>
<style name="logo_tv2">
<item name="android:layout_marginTop">20dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">@dimen/screen_text</item>
<item name="android:textColor">@android:color/black</item>
</style>
<style name="logo_desc_tv">
<item name="android:layout_marginTop">25dp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:textSize">@dimen/normal_text</item>
<item name="android:lineSpacingExtra">@dimen/small_line_spacing</item>
</style>
<style name="logo_desc_tv2">
<item name="android:layout_marginTop">40dp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:textSize">@dimen/normal_text</item>
<item name="android:lineSpacingExtra">@dimen/small_line_spacing</item>
</style>
<style name="logo_desc_tv3">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:textSize">@dimen/small_text</item>
<item name="android:lineSpacingExtra">@dimen/small_line_spacing</item>
</style>
<style name="welcome_tv1">
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">@dimen/welcome_text1</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:text">Welcome!</item>
</style>
<style name="welcome_tv2">
<item name="android:layout_marginTop">25dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">@dimen/welcome_text2</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:lineSpacingExtra">@dimen/normal_line_spacing</item>
<item name="android:text">Keep track of your health\nwith RhythmCor</item>
</style>
<style name="welcome_footer_btns">
<item name="android:background">@null</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:layout_margin">10dp</item>
<item name="android:textSize">@dimen/welcome_btn_text</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="external_buttons">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">40dp</item>
<item name="android:layout_marginBottom">24dp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:background">@color/colorPrimary</item>
<item name="android:padding">12dp</item>
</style>
<style name="external_buttons1">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">-10dp</item>
<item name="android:layout_marginBottom">20dp</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@null</item>
<item name="android:padding">12dp</item>
</style>
<style name="external_buttons2">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">40dp</item>
<item name="android:layout_marginBottom">40dp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:background">@color/colorPrimary</item>
<item name="android:padding">12dp</item>
</style>
</resources>
我在build.gradle中的依赖项是:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
testCompile 'junit:junit:4.12'
}
答案 0 :(得分:0)
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Toolbar style -->
<item name="toolbarStyle">@style/MyToolBarStyle</item>
<!-- Spinner style -->
<item name="spinnerStyle">@style/MySpinner</item>
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!--
colorAccent is used as the default value for colorControlActivated,
which is used to tint widgets -->
<item name="colorAccent">@color/colorAccent</item>
</style>
答案 1 :(得分:0)
我只需更新我的android工作室就可以了!
答案 2 :(得分:0)
在xml编码中使用@ style / Theme.AppCompat.Light.DarkActionBar替换@ style / ThemeOverlay.AppCompat.Dark.ActionBar。