Android ActionBar 工具栏消失在我的应用程序中

Android ActionBar 工具栏消失在我的应用程序中,第1张

概述所以我有一个应用程序.目前有3个活动…我正在用意图从另一个活动中启动活动MainActivity>ChallongeLogin>ChallongeEvents在我的MainActivity和ChallongeLogin中,应用程序顶部有一个大栏,列出了我的应用程序名称.但是,当我最终阅读ChallongeEvents时,该条消失了……我不记

所以我有一个应用程序.目前有3个活动…我正在用意图从另一个活动中启动活动

MainActivity > ChallongeLogin > ChallongeEvents

在我的MainActivity和ChallongeLogin中,应用程序顶部有一个大栏,列出了我的应用程序名称.但是,当我最终阅读ChallongeEvents时,该条消失了……我不记得做任何特别的事情使该条消失了.为什么消失了?

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"    package="com.testing.testingapp">    <uses-permission androID:name="androID.permission.INTERNET" />    <application        androID:allowBackup="true"        androID:icon="@mipmap/ic_launcher"        androID:label="@string/app_name"        androID:supportsRtl="true"        androID:theme="@style/Apptheme">        <activity            androID:screenorIEntation="portrait"            androID:name=".MainActivity">            <intent-filter>                <action androID:name="androID.intent.action.MAIN" />                <category androID:name="androID.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <activity            androID:screenorIEntation="portrait"            androID:name=".ChallongeLogin" />        <activity            androID:screenorIEntation="portrait"            androID:name=".ChallongeEvents" />    </application></manifest>

解决方法:

根据您的要求,您必须扩展AppCompatActivity而不是Activity.

public class Activityname extends AppCompatActivity {  // ...}
@H_502_26@

AppCompatActivity is from the appcompat-v7 library. Principally, this
offers a backport of the action bar. Since the native action bar was
added in API Level 11, you do not need AppCompatActivity for that.
However, current versions of appcompat-v7 also add a limited backport
of the Material Design aesthetic, in terms of the action bar and
varIoUs Widgets. There are pros and cons of using appcompat-v7, well
beyond the scope of this specific Stack Overflow answer.

参考

@H_502_26@

07001

总结

以上是内存溢出为你收集整理的Android ActionBar /工具栏消失在我的应用程序中全部内容,希望文章能够帮你解决Android ActionBar /工具栏消失在我的应用程序中所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

    保存