Questions about the Error:error parsing Xml:not well-formed (invalid token) error when you use a custom control in a layout file

Source: Internet
Author: User

Today, after attempting to customize a control, the error is used in the layout file

<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Xmlns:tools= "Http://schemas.android.com/tools"
xmlns:carrey= "Http://schemas.android.com/apk/res/com.example.customview"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:paddingbottom= "@dimen/activity_vertical_margin"
android:paddingleft= "@dimen/activity_horizontal_margin"
android:paddingright= "@dimen/activity_horizontal_margin"
android:paddingtop= "@dimen/activity_vertical_margin"
Tools:context= ". Mainactivity ">


<com.carrey.customview.customview
Android:id= "@+id/customview"
Android:layout_width= "200DP"
android:layout_height= "200DP"
Android:layout_centerinparent= "true"
Android:background= "#FFD700"
Carrey:imagealpha= "0.5"
Carrey:imageaspectratio= "1.0"
Carrey:imagepaddingbottom= "5DP"
carrey:imagepaddingleft= "5DP"
carrey:imagepaddingright= "5DP"
carrey:imagepaddingtop= "5DP"
Carrey:imagescaletype= "Center"
carrey:imagesrc= "@drawable/b_fuzhuang01"
Carrey:subtitlepaddingbottom= "3DP"
carrey:subtitlepaddingleft= "3DP"
carrey:subtitlepaddingright= "3DP"
carrey:subtitlepaddingtop= "3DP"
Carrey:subtitletext= "This is level two sub-title"
Carrey:subtitletextcolor= "#00FF7F"
Carrey:subtitletextsize= "20SP"
Carrey:titlepaddingbottom= "4DP"
carrey:titlepaddingleft= "4DP"
carrey:titlepaddingright= "4DP"
carrey:titlepaddingtop= "4DP"
Carrey:titletext= "This is a headline"
Carrey:titletextcolor= "#1E90FF"
Carrey:titletextsize= "30sp"/>
</RelativeLayout>

Tip Error Error:error parsing xml:not well-formed (invalid token) at the time of the package name referencing the custom control. Tangled for a long time to solve. There may be two reasons, one is xmlns:carrey= "Http://schemas.android.com/apk/res/com.example.customview" The package name has a problem, The package name here must be the package name in the configuration file. Another possibility is that there is a problem with the format or coding, when there is a problem with the format, even if the package name is correct, it will not find a specific error point. At this point you need to format, Ctrl+shift+f is a formatted shortcut key. My problem is to solve this, record it.





Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Questions about the Error:error parsing Xml:not well-formed (invalid token) error when you use a custom control in a layout file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.