<Android>getAccessibilityClassName 出现的错误

本文探讨了在WebView的onPageFinished方法中调用getAccessibilityClassName时出现的兼容性问题,特别是在某些特定型号的手机上。该问题源于API的变化,涉及到Android-23中的ViewGroup的onInitializeAccessibilityNodeInfo方法的变动。

<Android>getAccessibilityClassName 出现的错误

曾经遇到过一个api,即标题提到的,

在webview中的onPageFinished方法里曾经调用过,结果爆出错误:

vivo x6上报错:

vivo y13报错:


其他手机型号均没有报错,getAccessibilityClassName 这个api,从字面意思上来看,是调用可访问的类名,在android-23中ViewGroup的onInitializeAccessibilityNodeInfo方法被 @hide 掉了 看api文档已经没有了
而是使用的getAccessibilityClassName 从而导致了2个系统版本的差异。

// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package android.widget; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewDebug.ExportedProperty; public class TableRow extends LinearLayout { public TableRow(Context context) { super((Context)null); throw new RuntimeException("Stub!"); } public TableRow(Context context, AttributeSet attrs) { super((Context)null); throw new RuntimeException("Stub!"); } public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener) { throw new RuntimeException("Stub!"); } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { throw new RuntimeException("Stub!"); } protected void onLayout(boolean changed, int l, int t, int r, int b) { throw new RuntimeException("Stub!"); } public View getVirtualChildAt(int i) { throw new RuntimeException("Stub!"); } public int getVirtualChildCount() { throw new RuntimeException("Stub!"); } public LayoutParams generateLayoutParams(AttributeSet attrs) { throw new RuntimeException("Stub!"); } protected LinearLayout.LayoutParams generateDefaultLayoutParams() { throw new RuntimeException("Stub!"); } protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { throw new RuntimeException("Stub!"); } protected LinearLayout.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { throw new RuntimeException("Stub!"); } public CharSequence getAccessibilityClassName() { throw new RuntimeException("Stub!"); } public static class LayoutParams extends LinearLayout.LayoutParams { @ExportedProperty( category = "layout" ) public int column; @ExportedProperty( category = "layout" ) public int span; public LayoutParams(Context c, AttributeSet attrs) { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } public LayoutParams(int w, int h) { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } public LayoutParams(int w, int h, float initWeight) { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } public LayoutParams() { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } public LayoutParams(int column) { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } public LayoutParams(ViewGroup.LayoutParams p) { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } public LayoutParams(ViewGroup.MarginLayoutParams source) { super((ViewGroup.LayoutParams)null); throw new RuntimeException("Stub!"); } protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) { throw new RuntimeException("Stub!"); } } } 没有setMinWidth
06-07
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值