【android开发】btn = (Button) this.findViewById(R.id.Random);

Android

1个回答

写回答

Yao2020

2026-01-17 18:00

+ 关注

1. 所有控件都是继承自View类,因此都具备View的特性。2. 在这里,this指代当前类。如果在Activity中,则为activity.this,表示当前Activity的句柄。可以这样理解。3. 左侧的BTN是一个自定义变量,而findViewById方法用于获取并返回与之关联的对象。

举报有用(0分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号