gpt4 book ai didi

android - SetFocusable 函数在它应该对我有用的 API 中对我不起作用

转载 作者:行者123 更新时间:2023-12-04 23:54:23 26 4
gpt4 key购买 nike

我在下面有这段代码,一切都适用于 Android 9

RespM= FindViewById<RecyclerView>(Resource.Id.RespMedius);
RespM.SetFocusable(ViewFocusability.NotFocusable);

但是当我想在 API 17 中尝试它时,我收到以下错误,因为假定函数 SetFocusableAPI 14 中 应该适合我……有什么解决方案吗?

Java.Lang.NoSuchMethodError: 'no method with name='setFocusable' signature='(I)V' in class Landroid/view/View;'

最佳答案

SetFocusable(int focusable) 添加到 API-26。

Setting this to NOT_FOCUSABLE will ensure that this view is also not focusable in touch mode.

SetFocusable(boolean focusable) 已添加到 API-1 中。

由于您正在使用 NotFocusable,您可以使用:

someView.SetFocusable(false);
someView.SetFocusableInTouchMode(false);

关于android - SetFocusable 函数在它应该对我有用的 API 中对我不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59148152/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com