Button button = (Button) findViewById(R.id.Button);

最后的Button有报错Button cannot be resolved or is not a field
2025-05-19 08:45:14
推荐回答(1个)
回答1:

你好,R.id.Button 中的button应该是你layout中main.xml文件中添加的button的id名
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
可以试一下