android-getActionBar()在SDK更新到5.0后返回null

android-getActionBar()在SDK更新到5.0后返回null,第1张

概述在我将 Android SDK更新到5.0版之后,getActionBar()方法开始返回null,导致我的应用程序在启动时崩溃.我对导致这种情况的原因一无所知,任何现有的Stackoverflow线程都无济于事. 这是我的清单: <application android:name="App" android:allowBackup="true" android:icon= 在我将 Android SDK更新到5.0版之后,getActionbar()方法开始返回null,导致我的应用程序在启动时崩溃.我对导致这种情况的原因一无所知,任何现有的Stackoverflow线程都无济于事.

这是我的清单:

<application    androID:name="App"    androID:allowBackup="true"    androID:icon="@drawable/ic_launcher"    androID:label="@string/app_name"    androID:theme="@style/Actionbartheme" >

styles.xml:

<style name="AppBasetheme" parent="theme.AppCompat.light"></style><!-- Application theme. --><style name="Apptheme" parent="AppBasetheme"></style><style name="ListItempadding">    <item name="androID:paddingtop">8dp</item>    <item name="androID:paddingRight">5dp</item>    <item name="androID:paddingBottom">8dp</item>    <item name="androID:paddingleft">5dp</item></style>

的themes.xml:

<?xml version="1.0" enCoding="utf-8"?><resources xmlns:androID="http://schemas.androID.com/apk/res/androID"><!-- the theme applIEd to the application or activity --><style name="Actionbartheme" parent="@style/theme.AppCompat.light.DarkActionbar">    <item name="androID:actionbarStyle">@style/Actionbar</item>    <item name="androID:actionOverflowbuttonStyle">@style/Overflowbutton</item>    <!-- Support library compatibility -->    <item name="actionbarStyle">@style/Actionbar</item>    <item name="actionOverflowbuttonStyle">@style/Overflowbutton</item></style><style name="Overflowbutton" parent="androID:style/Widget.Holo.Actionbutton.Overflow">    <item name="androID:src">@drawable/menu</item></style><!-- Actionbar styles --><style name="Actionbar" parent="@style/Widget.AppCompat.light.Actionbar.solID.Inverse">    <item name="androID:background">@color/main</item>    <!-- Support library compatibility -->    <item name="background">@color/main</item></style></resources>

和我的gradle依赖项:

dependencIEs {compile 'com.github.jenzz.undobar:library:1.1:API8Release@aar'compile 'com.androID.support:support-v4:21.0.0'compile 'com.androID.support:appcompat-v7:21.0.0'compile 'com.loopj.androID:androID-async-http:1.4.5'compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'compile 'com.Google.androID.gms:play-services:6.1.+'}

任何帮助是极大的赞赏!

解决方法 正如您在此处所做的那样,在使用ActionBaractivity和appcompat-v7时使用getSupportActionbar(). 总结

以上是内存溢出为你收集整理的android-getActionBar()在SDK更新到5.0后返回null全部内容,希望文章能够帮你解决android-getActionBar()在SDK更新到5.0后返回null所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1134913.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存