第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

代碼和老師一樣,出現(xiàn)停止運行

package com.ab.eat;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ToggleButton;
import android.os.Build;

public class MainActivity extends ActionBarActivity {
?? ?private CheckBox checkbox;
??? @Override
??? protected void onCreate(Bundle savedInstanceState) {
??????? super.onCreate(savedInstanceState);
??????? setContentView(R.layout.activity_main);
//?????? 初始化checkbox
??????? checkbox=(CheckBox) findViewById(R.id.checkbox);
//??????? 通過設置checkbox的監(jiān)聽事件來對checkbox進行處理,看是否被選中
??????? checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
?? ??? ??? ?
?? ??? ??? ?@Override
?? ??? ??? ?public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//?? ??? ??? ??? ?通過onCheckedChanged來監(jiān)聽CheckBox是否被選中
?? ??? ??? ??? ?String text=checkbox.getText().toString();
?? ??? ??? ??? ?if(isChecked){
?? ??? ??? ??? ??? ?//獲得CheckBox的文本內(nèi)容
?? ??? ??? ??? ??? ?Log.i("tag", text);
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?});
?? ?}
}



<CheckBox
??????? android:checked="false"
??????? android:id="@+id/checkBox1"
??????? android:layout_width="wrap_content"
??????? android:layout_height="wrap_content"
??????? android:text="籃球" />

正在回答

1 回答

public class MainActivity extends ActionBarActivity {
?? ?private CheckBox checkbox;
??? @Override
??? protected void onCreate(Bundle savedInstanceState) {
??????? super.onCreate(savedInstanceState);
??????? setContentView(R.layout.activity_main);
//?????? 初始化checkbox
??????? checkbox=(CheckBox) findViewById(R.id.checkbox);
//??????? 通過設置checkbox的監(jiān)聽事件來對checkbox進行處理,看是否被選中
??????? checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
?? ??? ??? ?
?? ??? ??? ?@Override
?? ??? ??? ?public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//?? ??? ??? ??? ?通過onCheckedChanged來監(jiān)聽CheckBox是否被選中
?? ??? ??? ??? ?String text=checkbox.getText().toString();
?? ??? ??? ??? ?if(isChecked){
?? ??? ??? ??? ??? ?//獲得CheckBox的文本內(nèi)容
?? ??? ??? ??? ??? ?Log.i("tag", text);
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?});
?? ?}
}


把加粗下劃線部分改為“Activity”

1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android攻城獅的第一門課(入門篇)
  • 參與學習       312507    人
  • 解答問題       4931    個

想快速掌握Android應用開發(fā)基礎,選擇學習這門課程就對了。

進入課程

代碼和老師一樣,出現(xiàn)停止運行

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號