在xml文件中使用自己的标签。

来源:互联网 发布:91熊猫桌面软件 编辑:程序博客网 时间:2024/06/06 00:41
举例:在xml文件头开始的地方,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:wuweiyun="http://schemas.android.com/apk/res/com.hx.wwy"  //如左边所示“wuweiyun”是自己定义的标签名称,"http://schemas.android.com/apk/res/com.hx.wwy是资源目录
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/backgroud_darktyellow"
    android:orientation="vertical" >


标签使用:
<com.hx.wwy.widget.RoundImageView
            android:id="@+id/avatar"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_marginLeft="20dp"
            android:scaleType="fitXY"
            wuweiyun:src="@drawable/defaulticon"     //如左所示
            wuweiyun:type="circle" />  //如左所示
0 0