【发布时间】:2023-04-09 13:03:01
【问题描述】:
在 Android Studio 中,应用的显示效果如我所愿。虽然在调试应用程序时,显示应用程序名称的横幅会消失。
我在哪里出错了?
为了更清楚,下面是它在 Android Studio 上的显示方式:
这是我运行应用程序时的显示方式(您可以看到没有横幅)
activity_main.xml
<?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>
【问题讨论】: