Ich habe eine benutzerdefinierte Ansicht namens SquareImageView
, die ich in meiner XML-Datei verwenden möchte. Aber mein XML scheint es nicht zu lösen. Warum? Ich habe versucht, es den vollqualifizierten Namespace in KleinXamarin nicht meine benutzerdefinierte Ansicht
xml geben:
<?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>
Klasse:
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
hat eine Unterstreichungs sagen invalid child element pokemonmobileclient.SquareImageView
Warum kann ich nicht verweisen es?
Dank