Reputation: 487
I just updated my Android Studio and Android SDK, and now I can't do anything in my XMLs. It shows the same thing as previous, but I can't add anything and something got messed up.
Example:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/bocterAppLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/bocterapp"
android:contentDescription=""/>
</LinearLayout>
It error says: "Element ImageView is not allowed here".
Do you have any idea why this has happened?
Cheers!
Upvotes: 6
Views: 4589
Reputation: 18871
I also had the same problem. In my case, I was using a container from the old support library. So changing
<android.support.constraint.ConstraintLayout ... />
to
<androidx.constraintlayout.widget.ConstraintLayout ... />
solved it for me - with no change to the ImageView.
Upvotes: 0
Reputation: 2740
I had the same problem. Try to exchange the ImageView with the android.support.v7.widget.AppCompatImageView! That solved it for me.
Upvotes: 4