Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 自定义视图属性如何检查它是选择器还是可绘制的_Android_Android Custom View_Android Drawable_Android Selector_Android Custom Attributes - Fatal编程技术网

Android 自定义视图属性如何检查它是选择器还是可绘制的

Android 自定义视图属性如何检查它是选择器还是可绘制的,android,android-custom-view,android-drawable,android-selector,android-custom-attributes,Android,Android Custom View,Android Drawable,Android Selector,Android Custom Attributes,我的自定义视图属性之一是: <attr name="socialViewAndroid_iconSrc" format="reference"/> 或通过可绘制的图标: app:socialViewAndroid_iconSrc="@drawable/icon_drawable" 在自定义视图构造函数中: mIconSrc = a.getResourceId(R.styleable.LikeViewHorizontal_socialViewAndroid_iconSrc, -1)

我的自定义视图属性之一是:

<attr name="socialViewAndroid_iconSrc" format="reference"/>
或通过可绘制的图标:

app:socialViewAndroid_iconSrc="@drawable/icon_drawable"
在自定义视图构造函数中:

mIconSrc = a.getResourceId(R.styleable.LikeViewHorizontal_socialViewAndroid_iconSrc, -1);

现在我需要知道的是
mIconSrc
a选择器还是图标可绘制。

使用
a.getDrawable()
请详细说明一下好吗?获得可绘制对象后要做什么?
mIconSrc = a.getResourceId(R.styleable.LikeViewHorizontal_socialViewAndroid_iconSrc, -1);