英文:
I got this error in my xml file : 'error: attribute altsrc not found.'
问题
I am getting the error from my xml file below, and I can't figure out what went wrong:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout 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"
app:layoutDescription="@xml/activity_welcome_scene"
tools:context=".ui.onboarding.WelcomeActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/onboaring_title1"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/welcome_banner"
android:contentDescription="@string/banner_1" />
<TextView
android:id="@+id/tv_onboardingDesc_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:gravity="center"
android:alpha="0"
android:text="@string/onboarding_desc_1"
android:textSize="15sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/menu1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:tint="@color/main_purple"
app:altsrc="@drawable/ic_circle_full_24"
app:layout_constraintEnd_toStartOf="@id/menu2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_onboardingDesc_1"
app:srcCompat="@drawable/ic_circle_24" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/menu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/main_purple"
app:altsrc="@drawable/ic_circle_full_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/menu3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@id/menu1"
app:layout_constraintTop_toTopOf="@+id/menu1"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/ic_circle_24" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/menu3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/main_purple"
app:altsrc="@drawable/ic_circle_full_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@id/menu2"
app:layout_constraintTop_toTopOf="@+id/menu2"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/ic_circle_24" />
</androidx.constraintlayout.motion.widget.MotionLayout>
And it seems to be coming from the app:altsrc
attribute on my ImageFilterView
. But there's no error or warning message in the xml file while I'm editing them. I can't find out why I got this error. Can anyone help me find out why? Here's the build error message:
英文:
I am getting the error from my xml file below, and I can't figure out what went wrong :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout 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"
app:layoutDescription="@xml/activity_welcome_scene"
tools:context=".ui.onboarding.WelcomeActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/onboaring_title1"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/welcome_banner"
android:contentDescription="@string/banner_1" />
<TextView
android:id="@+id/tv_onboardingDesc_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:gravity="center"
android:alpha="0"
android:text="@string/onboarding_desc_1"
android:textSize="15sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/menu1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:tint="@color/main_purple"
app:altsrc="@drawable/ic_circle_full_24"
app:layout_constraintEnd_toStartOf="@id/menu2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_onboardingDesc_1"
app:srcCompat="@drawable/ic_circle_24" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/menu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/main_purple"
app:altsrc="@drawable/ic_circle_full_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/menu3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@id/menu1"
app:layout_constraintTop_toTopOf="@+id/menu1"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/ic_circle_24" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/menu3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/main_purple"
app:altsrc="@drawable/ic_circle_full_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@id/menu2"
app:layout_constraintTop_toTopOf="@+id/menu2"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/ic_circle_24" />
</androidx.constraintlayout.motion.widget.MotionLayout>
And it seems to be coming from the app:altsrc
attribute on my ImageFilterView
. But there's no error or warning message in the xml file while I'm editing them. I can't find out why I got this error. Can anyone help me find out why? Here's the build error message :
答案1
得分: 1
尝试使用 altSrc
(大写 S
)如官方文档所述 此处:
英文:
Try with altSrc
(capital S
) as the official documentation says here:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论