自定義控件使用時注意的問題

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:nanlus="http://schemas.android.com/apk/res/com.practice.myattrsview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<com.practice.myattrsview.MyAttrsView
android:id="@+id/custom1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
nanlus:backgrounddrawable="@drawable/webpage"
nanlus:background="@drawable/background"
nanlus:custom_id="1"
nanlus:src="@drawable/ic_launcher"
nanlus:text="按鈕1"
>
</com.practice.myattrsview.MyAttrsView>

</RelativeLayout>
com.practice.myattrsview.MyAttrsView和xmlns:nanlus="http://schemas.android.com/apk/res/com.practice.myattrsview中的包名必須是在AndroidManifest.xml文件中 package指定的包android

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.practice.myattrsview"
  
web

    android:versionCode="1"
    android:versionName="1.0" >spa

相關文章
相關標籤/搜索