gpt4 book ai didi

java - findViewById 在 InputMethodService 中不起作用,我该怎么办?

转载 作者:太空狗 更新时间:2023-10-29 15:48:49 26 4
gpt4 key购买 nike

我正在尝试创建一个 android 键盘,这段代码到目前为止工作正常

package keyboard.rob.com;

import...

public class xyz extends InputMethodService
implements KeyboardView.OnKeyboardActionListener {

private LinearLayout mInputView;

@Override public View onCreateInputView() {
mInputView = (LinearLayout) getLayoutInflater().inflate(R.layout.main, null);
return mInputView;
}

...

但稍后当我尝试制作

LinearLayout LinLayBg = (LinearLayout)findViewById(R.id.LL_total);

用按钮填充它,它显示

“*方法 findViewById(int) 未定义类型 zyz *”

有什么想法吗?谢谢!

最佳答案

我认为您正在尝试从 View 的非实例调用方法 findViewById(int id);

尝试:

mInputView.findViewById(R.id.LL_total); 

希望对你有帮助

关于java - findViewById 在 InputMethodService 中不起作用,我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7244172/

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