开发者

CheckBox.setText do not work (Android)

开发者 https://www.devze.com 2023-03-10 01:21 出处:网络
CheckBox checkBox = new CheckBox(activity); CheckBox.setText(\"Hello\"); I tried to set the text after a check 开发者_如何转开发box as above. But it didnt show me anything. Any suggestions ?First :
CheckBox checkBox = new CheckBox(activity);
CheckBox.setText("Hello");

I tried to set the text after a check 开发者_如何转开发box as above. But it didnt show me anything. Any suggestions ?


First : you try to set the Text using the name of the class CheckBox ???

it should be the instance checkBox , like this :

CheckBox checkBox = new CheckBox(activity);
checkBox.setText("Hello");

Second :

did you try to add your checkBox to your Activity Content like this ??

this.setContentView(checkBox);

EDIT: : refer this , may be it will help you

0

精彩评论

暂无评论...
验证码 换一张
取 消