i am new to android development and was reading a book for it (beginning android 4 development) and while creating hello world i got stuck in few errors, first i solved them but my app was force closing so i copy pasted all thing and got 4 errors :-
Multiple annotations found at this line: - Attribute is missing the Android namespace prefix - Suspicious namespace: should start with http:// - Open quote is expected for attribute "xmlns:android" associated with an element type "LinearLayout". - error: Error parsing XML: not well-formed (invalid token)
Unexpected namespace prefix "android" found for tag TextView
Multiple annotations found at this line: - Unexpected namespace prefix "android" found for tag TextView - Attribute is missing the Android namespace prefix
Unexpected namespace prefix "android" found for tag Button
code sample
<?xml version ="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/ android”
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_orientation="vertical"
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”@string/This is my first Android Application!” />
<Button
android:layout_width="fill_parent"
android:layout_width="wrap_content"
android:text="@string/And this is clickable :D" />
i dont think there's any mistake in code :/
It's a copy - paste issue. Replace the quotes in line 2 with " and it should work
Replace the quotes of every line of code with " and use ctr+sift+f and save the file.
<?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" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/This is my first Android Application!" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/And this is clickable :D" />
</LinearLayout>
在您的xml中将“”替换为“”以使其成为有效的xml
apk/res/ android
使用以下方法删除此处的空间
apk/res/android
@string resources should be declare in strings.xml, try this ! And read more
<?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" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="hello" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is my first Android Application!" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="And this is clickable :D" />
</LinearLayout>
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.