具体原因是代替findViewById的插件被废弃了。 自定义导入会报错。 这里建议使用DateBing。 首先先绑定控件id,我在xml布局里面设置的id是one,于是绑定android控件的方式为: val one:EditText=findViewById(R.id.one) 获取输入框内容 val inpput_text=oen.text.toString() 全局设置不改变字母大小方法(写xml布局会发现android会自动把小写字母变为大写): 在xml的Button及其他里面加入:android:textAIICaps="false" 在EditText中提升内容: Android:hint="提示的内容" 使用ImageButton控件,引用资源文件 android:src="@drawable/ic_launcher_background"/> 更换图片资源 img.setImageResource(R.drawable.ic_launcher_foreground) Loading... 具体原因是代替findViewById的插件被废弃了。 自定义导入会报错。 这里建议使用DateBing。 首先先绑定控件id,我在xml布局里面设置的id是one,于是绑定android控件的方式为: val one:EditText=findViewById(R.id.one) 获取输入框内容 val inpput_text=oen.text.toString() 全局设置不改变字母大小方法(写xml布局会发现android会自动把小写字母变为大写): 在xml的Button及其他里面加入:android:textAIICaps="false" 在EditText中提升内容: Android:hint="提示的内容" 使用ImageButton控件,引用资源文件 android:src="@drawable/ic_launcher_background"/> 更换图片资源 img.setImageResource(R.drawable.ic_launcher_foreground) 最后修改:2021 年 04 月 16 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏