0
我有一個名爲SquareImageView
的自定義視圖,我想在我的xml文件中使用它。但我的XML似乎無法解決它。爲什麼?我試着給它以小寫完全合格的命名空間Xamarin沒有看到我的自定義視圖
XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<pokemonmobileclient.SquareImageView
android:id="@+id/picture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:layout_gravity="bottom"
android:textColor="@android:color/white"
android:background="#55000000"
/>
</FrameLayout>
類:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Text.Style;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace PokemonMobileClient
{
public class SquareImageView : ImageView
{
public SquareImageView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
public SquareImageView(Context context) : base(context)
{
}
public SquareImageView(Context context, IAttributeSet attrs) : base(context, attrs)
{
}
public SquareImageView(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr)
{
}
public SquareImageView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes)
{
}
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
SetMeasuredDimension(this.MeasuredWidth, this.MeasuredHeight);
}
}
}
<pokemonmobileclient.SquareImageView
有下劃線說invalid child element pokemonmobileclient.SquareImageView
我爲什麼不能引用它?
謝謝