zoukankan      html  css  js  c++  java
  • [Error] Error parsing XML: unbound prefix

    发生该错误的代码:

    <?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">
        <com.example.CustomWidget.MyView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
    
            android:id="@+id/surface"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:layout_weight="1"/>
    
    </LinearLayout>
    

    说明:com.example.CustomWidget is the name of my package and MyView is the name of my class file where I made the custom Widget.

    方案:

    xmlns:android="http://schemas.android.com/apk/res/android"

    becomes:

    xmlns:mynamespace="http://schemas.android.com/apk/res/com.myproject.myprojectname"
    

    Thereafter any custom attribute elements you define for your custom view will be referred to as:

    mynamespace:my_defined_attribute="success"

    instead of :

    android:layout_width="fill_parent"
    

      

  • 相关阅读:
    poj 2262
    poj 1050
    poj 1730
    poj 1061
    【设计模式】简单工厂模式学习
    【待学】
    [设计模式]策略模式和单一职责
    Windows live writer 误删 草稿 恢复
    [Linq]Linq To Sql (2)
    MVC 学习日志1(上)
  • 原文地址:https://www.cnblogs.com/ryq2014/p/5314539.html
Copyright © 2011-2022 走看看