typearray中的整数值.getType(int index)对应于

What do the integer values from TypedArray.getType(int index) correspond to?

本文关键字:index int 整数 getType typearray      更新时间:2023-10-16

在android中有一个TypedArray对象getType(int index)的方法,它返回一个int,如android文档

所述

在文档和我的研究中,我找不到返回的整数对应的是什么。

有人知道吗?

TypedArray object getType(int index) method返回指定索引处的属性类型。https://developer.android.com/reference/android/content/res/TypedArray.html方法(int)

例如

如果在xml中使用string作为数据类型,那么如果该数据类型为string,则返回的int值将为3。ie TYPE_STRING,

,如果数据类型为float,则返回值为4如果数据类型为float,即TYPE_FLOAT

有关更多详细信息,请参阅https://developer.android.com/reference/android/util/TypedValue.html查找以前缀TYPE_

开头的常量

希望它澄清!!