首页 新闻 赞助 找找看

android 5.0 getDimensionPixelSize方法问题

-1
悬赏园豆:20 [待解决问题]

TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View, defStyle, 0);

  a.getDimensionPixelSize(com.android.internal.R.styleable.View_padding, layout_unknow);

这个getDimensionPixelSize函数,在android5.0上直接崩溃

Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3
android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:572)

请问getDimensionPixelSize这个怎么解决?这个方法有替代方法吗?

< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册