ошибка несвязанного префикса в imageview

#android #imageview

#Android #imageview

Вопрос:

Я создал imageview для включения в другие макеты, и я получаю эту ошибку. «Ошибка при разборе XML: несвязанный префикс». Вот код.

      <ImageView android:id="@ id/water" 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:layout_weight="1"
                android:src="@drawable/water"
                android:scaleType="centerInside" />
  

Ответ №1:

Вам необходимо определить префикс Android:

 <?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
            android:id="@ id/water" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_weight="1"
            android:src="@drawable/water"
            android:scaleType="centerInside" />