未宣告的命名空間前綴“android”(用于屬性“layout_width”)
我怎樣才能解決這個問題?這表示 android 未定義。我該如何解決?請幫忙
uj5u.com熱心網友回復:
嘗試在布局中添加它
xmlns:android="http://schemas.android.com/apk/res/android
這是一個例子:
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
android:orientation="vertical">
uj5u.com熱心網友回復:
嘗試檢查其中一些。
您會看到此錯誤,名稱空間不正確或屬性中存在拼寫錯誤。像 'xmlns' 是錯誤的,應該是 xmlns:android
第一個節點需要包含: xmlns:android="http://schemas.android.com/apk/res/android"
如果您正在集成 AdMob,請檢查 ads:adSize 等自定義引數,您需要
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
- 如果您使用的是 LinearLayout,您可能需要定義工具:
xmlns:tools="http://schemas.android.com/tools"
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/460521.html
