简体   繁体   中英

ImageView inside LinearLayout not working

I have the following layout, each time I try to view it in the Graphical Layout it gives the error message below.

<?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="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/my_greeting" />

</LinearLayout>

The error

The following classes could not be found: - ImageView (Change to android.widget.ImageView, Fix Build Path, Edit XML)

close that file and reopen it. if wont solve the problem just clean and rebuild the project.

It's got to do something with your image source my_greeting . Check if the source name is right and check if you've given a valid extension. Also, try cleaning the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM