语言

TypedArray 类

定义

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

[Android.Runtime.Register("android/content/res/TypedArray", DoNotGenerateAcw=true)]
public class TypedArray : Java.Lang.Object, IDisposable, Java.Lang.IAutoCloseable
[<Android.Runtime.Register("android/content/res/TypedArray", DoNotGenerateAcw=true)>]
type TypedArray = class
    inherit Object
    interface IAutoCloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
继承
TypedArray
属性
实现

注解

使用或 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int). 检索Resources#obtainAttributes的值数组的容器。 请务必在完成时进行呼叫 #recycle 。

用于从此结构中检索值的索引对应于给定用于获取StyledAttributes 的属性的位置。

Java文档android.content.res.TypedArray。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

构造函数

名称 说明
TypedArray(IntPtr, JniHandleOwnership)

创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。

属性

名称 说明
ChangingConfigurations

返回此类型化数组中的值可能会更改的配置参数的掩码。

Class

返回此 Object的运行时类。

(继承自 Object)
Handle

基础 Android 实例的句柄。

(继承自 Object)
IndexCount

返回实际具有数据的数组中的索引数。

JniIdentityHashCode

获取互操作运行时分配给此Java对等的标识哈希代码。

(继承自 Object)
JniManagedPeerState

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
JniPeerMembers

获取用于调用此Java对等方成员的 JNI 元数据。

PeerReference

获取此Java对等方的 JNI 对象引用。

(继承自 Object)
PositionDescription

返回一条有关适合打印错误消息的分析程序状态的消息。

Resources

返回从中加载此数组的资源对象。

ThresholdClass

此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。

ThresholdType

此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。

方法

名称 说明
Clone()

创建并返回此对象的副本。

(继承自 Object)
Close()

回收 TypedArray,供稍后调用方重新使用。

Construct(JniObjectReference, JniObjectReferenceOptions)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
Dispose()

释放此Java对等方持有的资源。

(继承自 Object)
Dispose(Boolean)

释放此Java对等方持有的资源。

(继承自 Object)
DisposeUnlessReferenced()

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
Equals(Object)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
Equals(Object)

指示其他对象是否“等于”此对象。

(继承自 Object)
GetBoolean(Int32, Boolean)

检索 var<索引>/var< 处>属性的布尔值。

GetColor(Int32, Int32)

检索 var<索引>/var< 处>属性的颜色值。

GetColorStateList(Int32)

检索 var<索引>/var< 处属性的 >ColorStateList。

GetDimension(Int32, Single)

检索 var<索引>/var< 处>的维度单位属性。

GetDimensionPixelOffset(Int32, Int32)

检索 var<索引>/var< 处>的维度单位属性,以用作原始像素的偏移量。

GetDimensionPixelSize(Int32, Int32)

检索 var<索引>/var< 处>的维度单位属性,以用作原始像素的大小。

GetDrawable(Int32)

检索 var<索引>/var< 处>属性的 Drawable。

GetFloat(Int32, Single)

检索 var<索引>/var< 处>属性的浮点值。

GetFont(Int32)

检索 var<索引>/var< 处>属性的 Typeface。

GetFraction(Int32, Int32, Int32, Single)

检索 var<索引>/var< 处>的分数单位属性。

GetHashCode()

返回对象的哈希代码值。

(继承自 Object)
GetIndex(Int32)

返回包含数据的数组中的索引。

GetInt(Int32, Int32)

检索 var<索引>/var< 处>属性的整数值。

GetInteger(Int32, Int32)

检索 var<索引>/var< 处>属性的整数值。

GetLayoutDimension(Int32, Int32)

用于检索#getDimensionPixelSizelayout_width和layout_height属性的特殊版本android.view.ViewGroup。

GetLayoutDimension(Int32, String)

用于检索#getDimensionPixelSizelayout_width和layout_height属性的特殊版本android.view.ViewGroup。

GetNonResourceString(Int32)

检索 var<索引>/var< 处>属性的字符串值,但前提是该字符串来自 XML 文件中的即时值。

GetResourceId(Int32, Int32)

检索 var<索引>/var< 处>属性的资源标识符。

GetSourceResourceId(Int32, Int32)

返回已解析指定属性的样式或布局的资源 ID,否则返回 defValue。

GetString(Int32)

检索 var<索引>/var< 处>属性的字符串值。

GetText(Int32)

检索 var<索引>/var< 处>属性的样式字符串值。

GetTextArray(Int32)

检索 var<索引>/var< 属性>的 CharSequence[] 。

GetTextArrayFormatted(Int32)

检索 var<索引>/var< 属性>的 CharSequence[] 。

GetTextFormatted(Int32)

检索 var<索引>/var< 处>属性的样式字符串值。

GetType(Int32)

返回指定索引处的属性的类型。

GetValue(Int32, TypedValue)

检索 var<索引>/var< 处>属性的原始 TypedValue。

HasValue(Int32)

确定 var<索引>/var< 是否有>属性。

HasValueOrEmpty(Int32)

确定 var<索引>/var< 中>是否存在属性,true返回属性是否显式设置为@empty且false仅当属性未定义时返回。

JavaFinalize()
已过时.

当垃圾回收确定不再引用该对象时,由对象上的垃圾回收器调用。

(继承自 Object)
Length()

返回此数组中的值数。

Notify()

唤醒正在等待此对象的监视器的单个线程。

(继承自 Object)
NotifyAll()

唤醒正在等待此对象的监视器的所有线程。

(继承自 Object)
PeekValue(Int32)

检索 var<index>/var< 属性>的原始 TypedValue,并返回保存其数据的临时对象。

Recycle()

回收 TypedArray,供稍后调用方重新使用。

SetHandle(IntPtr, JniHandleOwnership)

设置 Handle 属性。

(继承自 Object)
SetPeerReference(JniObjectReference, JniObjectReferenceOptions)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
ToArray<T>()

从此Java数组包装器创建托管数组。

(继承自 Object)
ToString()

返回对象的字符串表示形式。

(继承自 Object)
UnregisterFromRuntime()

从互操作运行时取消注册此Java对等。

(继承自 Object)
Wait()

使当前线程等待,直到唤醒它,通常是通过 em 通知/em< 或 >em<interrupted>/em<。><>

(继承自 Object)
Wait(Int64, Int32)

使当前线程等待直到唤醒,通常是通过 <em>通知</em> 或 <em interrupted>/em<>,或直到经过一定数量的实时。

(继承自 Object)
Wait(Int64)

使当前线程等待直到唤醒,通常是通过 <em>通知</em> 或 <em interrupted>/em<>,或直到经过一定数量的实时。

(继承自 Object)

显式接口实现

名称 说明
IJavaPeerable.Disposed()

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
IJavaPeerable.Finalized()

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

(继承自 JavaObject)
IJavaPeerable.UnregisterFromRuntime()

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

扩展方法

名称 说明
GetJniTypeName(IJavaPeerable)

获取实例 self类型的 JNI 名称。

JavaAs<TResult>(IJavaPeerable)

尝试强制self键入TResult,检查强制是否在Java端有效。

JavaCast<TResult>(IJavaObject)

执行 Android 运行时检查的类型转换。

JavaCast<TResult>(IJavaObject)

使用 检索的值数组的容器 Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) 或 Resources#obtainAttributes。

TryJavaCast<TResult>(IJavaPeerable, TResult)

尝试强制self键入TResult,检查强制是否在Java端有效。

适用于