【发布时间】:2020-06-30 14:53:58
【问题描述】:
在我的手机上从 android studio 运行的应用程序显示一个空白屏幕。它只在我手机上的 android studio 中作为已安装的应用程序运行时显示白屏。什么都没有显示,但是当我在android studio上运行它时,没有错误。如果有人可以请告诉我。这是我的截图 ==>enter image description here
.....JAVA 代码....
package com.example.testvegetablewheelbarrow;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
....XML 代码...
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_launcher_background"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="291dp"
android:layout_height="110dp"
android:textAlignment="viewStart"
android:textColor="#E60D0D"
android:textSize="36sp"
android:textStyle="bold"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.499"
tools:text="Hello Wold"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
【问题讨论】:
-
添加截图让问题更相关
-
向您发送清单代码
-
您能向我们展示您的 Java/Kotlin 代码和布局 xml 文件吗?
-
我上传了我的代码
-
也许您可以尝试将
android:background="@drawable/ic_launcher_background"更改为android:background="#000000".
标签: android android-studio android-layout android-fragments android-studio-3.0