【发布时间】:2021-05-09 10:56:20
【问题描述】:
我创建了一个应用程序项目,当我尝试单击将我引导至配置文件设置的配置文件时,它没有显示任何内容,但我在 xml 文件中放置了背景和一些文本。我在 logcat 中看到了这些错误:
E/BufferQueueProducer: [SurfaceTexture-0-26097-0](id:65f100000000,api:0,p:-1,c:26097) disconnect: not connected (req=1)
E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
E/ViewRootImpl@f0e9ae3[MainActivity]: Surface is not valid.
这是 xml 文件。具有 final_logo_transparent 的 ImageView 是我添加为背景的图像,并且我在其他 xml 文件中使用过它,因此与此无关。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
tools:context=".Profile">
<ImageView
android:id="@+id/imageView5"
android:layout_width="409dp"
android:layout_height="287dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginBottom="32dp"
android:foregroundGravity="center"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/final_logo_transparent" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:fontFamily="monospace"
android:paddingHorizontal="80dp"
android:text="Disconnect"
android:textColor="#000000"
android:textSize="36sp"
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.98" />
<ImageView
android:id="@+id/profileImage"
android:layout_width="221dp"
android:layout_height="202dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="347dp"
android:src="@drawable/user"
app:layout_constraintBottom_toTopOf="@+id/textView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView5"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
【问题讨论】:
-
请添加一些代码,以便我们做点什么。
-
我已经添加了java文件
-
你的问题是xml文件所以请添加xml文件
-
抱歉,我已经添加了 XML 文件
标签: java xml android-studio