gpt4 book ai didi

android - findViewById(R.id. 什么也没找到

转载 作者:行者123 更新时间:2023-11-29 16:23:10 26 4
gpt4 key购买 nike

我正在使用 eclipse,它一直显示错误消息

txt cannot be resolved or is not a field

我有这个 xml

 <EditText
android:id="@+id/txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

我在java文件中有这个

    setContentView(R.layout.test);
txt = (EditText) findViewById(R.id.txt);

它定位测试很好,但不是 txt,实际上,如果我将测试更改为任何内容,然后在该 xml 文件中添加一些内容,下一行不会注册 ID!是 eclipse 有问题还是我的编程有问题?

有任何帮助

最佳答案

尝试清理并重建您的项目;有时 builder 会感到困惑。

关于android - findViewById(R.id. 什么也没找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6256222/

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