Java Android应用程序-当我调试应用程序时,工具栏会消失
在Android Studio中,该应用程序显示出我所期望的效果。尽管在调试应用程序时,显示应用程序名称的横幅会消失 我哪里出错了 更清楚地说,以下是它在Android Studio上的显示方式: 以下是我运行应用程序时的显示方式(如您所见,没有横幅) 活动\u main.xmlJava Android应用程序-当我调试应用程序时,工具栏会消失,java,android,Java,Android,在Android Studio中,该应用程序显示出我所期望的效果。尽管在调试应用程序时,显示应用程序名称的横幅会消失 我哪里出错了 更清楚地说,以下是它在Android Studio上的显示方式: 以下是我运行应用程序时的显示方式(如您所见,没有横幅) 活动\u main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.it5.foothillers.MainActivity"
android:background="#f4f4f4">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:paddingEnd="0dp"
android:paddingStart="0dp"
android:layout_margin="0dp">
<Button
android:layout_width="fill_parent"
android:layout_height="23dp"
android:text="NEWS"
android:id="@+id/button"
android:layout_weight="0.28"
android:background="@android:color/holo_blue_bright"
android:textColor="#ffffff"
android:textSize="48dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SPORTS"
android:id="@+id/button2"
android:layout_weight="0.20"
android:background="@android:color/holo_blue_light"
android:textColor="#ffffff"
android:textSize="48dp" />
<Button
android:layout_width="match_parent"
android:layout_height="24dp"
android:text="EVENTS"
android:id="@+id/button3"
android:layout_weight="0.29"
android:background="@android:color/holo_blue_dark"
android:textColor="#ffffff"
android:textSize="48dp" />
<Button
android:layout_width="match_parent"
android:layout_height="24dp"
android:text="MORE"
android:id="@+id/button4"
android:layout_weight="0.24"
android:background="#f1f108"
android:textSize="48dp" />
</LinearLayout>
</RelativeLayout>
更新:
如果您的应用程序扩展了
活动
,请将if更改为AppCompatActivity
确保您的类扩展了AppCompatActivity,如果仍然看不到操作栏,请尝试将AndroidManifest.xml中的应用主题更改为theme.AppCompat.Light.DarkActionBar
您也可以尝试在res中的styles.xml中设置此选项
<item name="android:windowActionBar">false</item>
false
我希望有帮助!亲切的问候 如果您查看此用户提供的主题,您会发现主题已被使用。谢谢,我想他只需要
AppCompatActivity
。嘿,您是英雄!!!非常感谢。成功了:)@mounirelfassing欢迎你,很高兴能帮助你,你现在可以投票了,你有20分了!!!谢谢你,这是一个如此简单的修复。actionbar是通过将类扩展更改为AppCompatActivity来显示的。成功了!!!这么简单的解决方法@Isaac