我在我的 XML 文件中遇到了这个错误:’error: attribute altsrc not found.’

huangapple go评论65阅读模式
英文:

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:

我在我的 XML 文件中遇到了这个错误:’error: attribute altsrc not found.’

英文:

I am getting the error from my xml file below, and I can't figure out what went wrong :

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;androidx.constraintlayout.motion.widget.MotionLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
xmlns:tools=&quot;http://schemas.android.com/tools&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;match_parent&quot;
app:layoutDescription=&quot;@xml/activity_welcome_scene&quot;
tools:context=&quot;.ui.onboarding.WelcomeActivity&quot;&gt;
&lt;TextView
android:id=&quot;@+id/textView&quot;
android:layout_width=&quot;wrap_content&quot;
android:layout_height=&quot;wrap_content&quot;
android:text=&quot;@string/onboaring_title1&quot;
android:textSize=&quot;25sp&quot;
app:layout_constraintEnd_toEndOf=&quot;parent&quot;
app:layout_constraintStart_toStartOf=&quot;parent&quot;
app:layout_constraintTop_toBottomOf=&quot;@+id/imageView&quot; /&gt;
&lt;ImageView
android:id=&quot;@+id/imageView&quot;
android:layout_width=&quot;wrap_content&quot;
android:layout_height=&quot;wrap_content&quot;
android:layout_marginTop=&quot;150dp&quot;
app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
app:layout_constraintStart_toStartOf=&quot;parent&quot;
app:layout_constraintTop_toTopOf=&quot;parent&quot;
app:layout_constraintVertical_bias=&quot;0.0&quot;
app:srcCompat=&quot;@drawable/welcome_banner&quot;
android:contentDescription=&quot;@string/banner_1&quot; /&gt;
&lt;TextView
android:id=&quot;@+id/tv_onboardingDesc_1&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;wrap_content&quot;
android:layout_marginStart=&quot;24dp&quot;
android:layout_marginTop=&quot;16dp&quot;
android:layout_marginEnd=&quot;24dp&quot;
android:gravity=&quot;center&quot;
android:alpha=&quot;0&quot;
android:text=&quot;@string/onboarding_desc_1&quot;
android:textSize=&quot;15sp&quot;
app:layout_constraintEnd_toEndOf=&quot;parent&quot;
app:layout_constraintStart_toStartOf=&quot;parent&quot;
app:layout_constraintTop_toBottomOf=&quot;@+id/textView&quot; /&gt;
&lt;androidx.constraintlayout.utils.widget.ImageFilterView
android:id=&quot;@+id/menu1&quot;
android:layout_width=&quot;wrap_content&quot;
android:layout_height=&quot;wrap_content&quot;
app:tint=&quot;@color/main_purple&quot;
app:altsrc=&quot;@drawable/ic_circle_full_24&quot;
app:layout_constraintEnd_toStartOf=&quot;@id/menu2&quot;
app:layout_constraintHorizontal_bias=&quot;0.5&quot;
app:layout_constraintStart_toStartOf=&quot;parent&quot;
app:layout_constraintTop_toBottomOf=&quot;@+id/tv_onboardingDesc_1&quot;
app:srcCompat=&quot;@drawable/ic_circle_24&quot; /&gt;
&lt;androidx.constraintlayout.utils.widget.ImageFilterView
android:id=&quot;@+id/menu2&quot;
android:layout_width=&quot;wrap_content&quot;
android:layout_height=&quot;wrap_content&quot;
android:tint=&quot;@color/main_purple&quot;
app:altsrc=&quot;@drawable/ic_circle_full_24&quot;
app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
app:layout_constraintEnd_toStartOf=&quot;@id/menu3&quot;
app:layout_constraintHorizontal_bias=&quot;0.5&quot;
app:layout_constraintStart_toEndOf=&quot;@id/menu1&quot;
app:layout_constraintTop_toTopOf=&quot;@+id/menu1&quot;
app:layout_constraintVertical_bias=&quot;0.0&quot;
app:srcCompat=&quot;@drawable/ic_circle_24&quot; /&gt;
&lt;androidx.constraintlayout.utils.widget.ImageFilterView
android:id=&quot;@+id/menu3&quot;
android:layout_width=&quot;wrap_content&quot;
android:layout_height=&quot;wrap_content&quot;
android:tint=&quot;@color/main_purple&quot;
app:altsrc=&quot;@drawable/ic_circle_full_24&quot;
app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
app:layout_constraintEnd_toEndOf=&quot;parent&quot;
app:layout_constraintHorizontal_bias=&quot;0.5&quot;
app:layout_constraintStart_toEndOf=&quot;@id/menu2&quot;
app:layout_constraintTop_toTopOf=&quot;@+id/menu2&quot;
app:layout_constraintVertical_bias=&quot;0.0&quot;
app:srcCompat=&quot;@drawable/ic_circle_24&quot; /&gt;
&lt;/androidx.constraintlayout.motion.widget.MotionLayout&gt;

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 :
我在我的 XML 文件中遇到了这个错误:’error: attribute altsrc not found.’

答案1

得分: 1

尝试使用 altSrc(大写 S)如官方文档所述 此处:

英文:

Try with altSrc (capital S) as the official documentation says here:

huangapple
  • 本文由 发表于 2023年5月25日 21:00:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76332556.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定