当前位置: 首页>>代码示例>>Java>>正文


Java ToggleButton.setOnCheckedChangeListener方法代码示例

本文整理汇总了Java中android.widget.ToggleButton.setOnCheckedChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java ToggleButton.setOnCheckedChangeListener方法的具体用法?Java ToggleButton.setOnCheckedChangeListener怎么用?Java ToggleButton.setOnCheckedChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ToggleButton的用法示例。


在下文中一共展示了ToggleButton.setOnCheckedChangeListener方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import android.widget.ToggleButton; //导入方法依赖的package包/类
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.student_recyclerview);
    btnSearch = (ToggleButton)findViewById(R.id.btn_search_student);
    btnSearchOk = (Button)findViewById(R.id.btn_search_ok_student);
    btnBack = (Button) findViewById(R.id.btn_back_student);
    editTextSearch =(EditText)findViewById(R.id.etxt_search_student);
    frameLayoutSearch = (FrameLayout)findViewById(R.id.frame_search_student);
    txtMsgContent = (TextView) findViewById(R.id.message_label_stud);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
 
开发者ID:inteliedoit,项目名称:thesis-project,代码行数:22,代码来源:StudentViewActivity.java

示例2: StudentAdapterViewHolder

import android.widget.ToggleButton; //导入方法依赖的package包/类
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
开发者ID:inteliedoit,项目名称:thesis-project,代码行数:20,代码来源:ExamInputAdapter.java

示例3: initViews

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initViews() {
    latitudeInput = (EditText) findViewById(R.id.latitude_input);
    longitudeInput = (EditText) findViewById(R.id.longitude_input);
    mockLocationView = (TextView) findViewById(R.id.mock_location_view);
    updatedLocationView = (TextView) findViewById(R.id.updated_location_view);
    mockModeToggleButton = (ToggleButton) findViewById(R.id.toggle_button);
    setLocationButton = (Button) findViewById(R.id.set_location_button);

    mockModeToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            setMockMode(isChecked);
            setLocationButton.setEnabled(isChecked);
        }
    });
    setLocationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addMockLocation();
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:MockLocationsActivity.java

示例4: ViewHolder

import android.widget.ToggleButton; //导入方法依赖的package包/类
public ViewHolder(View view) {
    super(view);
    mView = view;
    appNameTextView = (TextView) view.findViewById(R.id.appNameTextView);
    appPackageNameTextView = (TextView) view.findViewById(R.id.appPackageNameTextView);
    appIconImageView = (ImageView) view.findViewById(R.id.appIconImageView);
    hideAppToggleButton = (ToggleButton) view.findViewById(R.id.hideAppToggleButton);

    hideAppToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            String packageName = appPackageNameTextView.getText().toString();
            if (isChecked) {
                hideAppsPreferenceUtility.addAppToHiddenAppsList(packageName);
            } else {
                hideAppsPreferenceUtility.removeAppToHiddenAppsList(packageName);
            }
        }
    });
}
 
开发者ID:varunon9,项目名称:FakeLock,代码行数:21,代码来源:MyItemRecyclerViewAdapter.java

示例5: init

import android.widget.ToggleButton; //导入方法依赖的package包/类
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.teacher_schedule_recyclerview);
    btnSearch = (ToggleButton) findViewById(R.id._btn_search_schedule);
    btnSearchOk = (Button) findViewById(R.id._btn_search_ok_schedule);
    btnBack = (Button) findViewById(R.id.btn_back_schedule);
    editTextSearch = (EditText) findViewById(R.id.etxt_search_schedule);
    frameLayoutSearch = (FrameLayout) findViewById(R.id.frame_search_schedule);
    txtMsgContent = (TextView) findViewById(R.id.message_label_sc1);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
 
开发者ID:inteliedoit,项目名称:thesis-project,代码行数:23,代码来源:ScheduleViewActivity.java

示例6: onCreateView

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    log.i("onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_camera, container, false);

    mCameraManager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);

    mHandlerThread = new HandlerThread("CameraFragment_HandlerThread");
    mHandlerThread.start();
    mHandler = new Handler(mHandlerThread.getLooper());

    ttv_camera = (AutoFitTextureView) rootView.findViewById(R.id.ttv_camera);
    ttv_camera.setSurfaceTextureListener(this);

    tbtn_camera = (ToggleButton) rootView.findViewById(R.id.tbtn_camera);
    tbtn_camera.setOnCheckedChangeListener(this);

    return rootView;
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:20,代码来源:Camera2Fragment.java

示例7: onCreateView

import android.widget.ToggleButton; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final View rootView = inflater.inflate(R.layout.fragment_map, container, false);

    logTextView = (TextView) rootView.findViewById(R.id.textView1);

    final File filesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    fileMap = new File(filesDirectory, FILE_MAP);

    Utils.loadAd(rootView);
    setHasOptionsMenu(true);
    setupWebView(rootView);
    setupNmeaClientService();

    startStopButton = (ToggleButton) rootView.findViewById(R.id.startStopAisButton);
    startStopButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startReceivingAisFromAntenna();
            } else {
                stopReceivingAisFromAntenna();
            }
        }
    });

    // TODO: Not possible to stop. Will start automatically when valid PPM exists and hide (stop) button for now
    startStopButton.setVisibility(View.GONE);
    return rootView;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:33,代码来源:ShowMapFragment.java

示例8: initView

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void initView(View root) {
    super.initView(root);
    mToggleFloatStart = (ToggleButton) root.findViewById(R.id.toggleFloatFirst);
    mToggleFloatEnd = (ToggleButton) root.findViewById(R.id.toggleFloatEnd);
    mToggleFloatStart.setOnCheckedChangeListener(this);
    mToggleFloatEnd.setOnCheckedChangeListener(this);
    mPageScrollView.setLogTag("scrollView");
    initPageScrollViewItemClick(mPageScrollView);
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:11,代码来源:ExampleScrollViewFragment.java

示例9: initView

import android.widget.ToggleButton; //导入方法依赖的package包/类
protected void initView(View root) {
    mPageScrollView = (PageScrollView) root.findViewById(R.id.pageScrollView);
    mToggleAnim = (ToggleButton) root.findViewById(R.id.toggleTransform);
    mToggleCenter = (ToggleButton) root.findViewById(R.id.toggleChildCenter);
    mToggleAnim.setOnCheckedChangeListener(this);
    mToggleCenter.setOnCheckedChangeListener(this);
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:8,代码来源:ExampleFragment.java

示例10: onCreate

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_camera);

    mCameraManager = new CameraManager(this);

    mPreview = new CameraPreview(this, mCameraManager.getCamera());
    FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
    preview.addView(mPreview);

    mTextViewDigit = (TextView) findViewById(R.id.digit);
    mTextViewMatch = (TextView) findViewById(R.id.digit_match);

    mCaptureButton = (Button) findViewById(R.id.capture);
    mCaptureButton.setOnClickListener(this);

    mFlashToggle = (ToggleButton) findViewById(R.id.flash_toggle);
    mFlashToggle.setOnCheckedChangeListener(this);

    mDigitImageView = findViewById(R.id.digit_image);

    //ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor();
    //ex.scheduleWithFixedDelay(this, 1, 2, TimeUnit.SECONDS);
}
 
开发者ID:dhiogoboza,项目名称:iahandwritten,代码行数:30,代码来源:CameraActivity.java

示例11: onCreate

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);


    btnSearch = (ToggleButton)findViewById(R.id.btn_search_class);
    btnSearchOk = (Button)findViewById(R.id._btn_search_ok_class);
    btnBack = (Button) findViewById(R.id.btn_back_student);
    editTextSearch =(EditText)findViewById(R.id.etxt_search_class);
    frameLayoutSearch = (FrameLayout)findViewById(R.id.frame_search_class);

    frameLayoutSearch.setVisibility(View.GONE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                frameLayoutSearch.setVisibility(View.VISIBLE);
                tabLayout.setVisibility(View.GONE);
            } else {
                frameLayoutSearch.setVisibility(View.GONE);
                tabLayout.setVisibility(View.VISIBLE);
            }
        }
    });
}
 
开发者ID:inteliedoit,项目名称:thesis-project,代码行数:34,代码来源:Home_Activity.java

示例12: initUI

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initUI() {
    // init mVideoSurface
    mVideoSurface = (TextureView)findViewById(R.id.video_previewer_surface);

    recordingTime = (TextView) findViewById(R.id.timer);
    mCaptureBtn = (Button) findViewById(R.id.btn_capture);
    mRecordBtn = (ToggleButton) findViewById(R.id.btn_record);
    mShootPhotoModeBtn = (Button) findViewById(R.id.btn_shoot_photo_mode);
    mRecordVideoModeBtn = (Button) findViewById(R.id.btn_record_video_mode);
    mWayPointBtn=(Button)findViewById(R.id.btn_wayPoint);

    if (null != mVideoSurface) {
        mVideoSurface.setSurfaceTextureListener(this);
    }

    mCaptureBtn.setOnClickListener(this);
    mRecordBtn.setOnClickListener(this);
    mShootPhotoModeBtn.setOnClickListener(this);
    mRecordVideoModeBtn.setOnClickListener(this);
    mWayPointBtn.setOnClickListener(this);

    recordingTime.setVisibility(View.INVISIBLE);

    mRecordBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startRecord();
            } else {
                stopRecord();
            }
        }
    });
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:35,代码来源:UAVControllerActivity.java

示例13: onCreate

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    db = new DatabaseHandler(this);
    
    dataIta = cursorToArray(db.getData("Ita"));
    dataEng = cursorToArray(db.getData("Eng"));
    
    btnAddFav = (StarView) findViewById(R.id.btnAddFav);
    btnCheckFav = (StarView) findViewById(R.id.btnCheckFav);
    
    fontReg = Typeface.createFromAsset(getAssets(), "fonts/ZillaSlab-Regular.ttf");
    fontIta = Typeface.createFromAsset(getAssets(), "fonts/ZillaSlab-Italic.ttf");
    fontBold = Typeface.createFromAsset(getAssets(), "fonts/ZillaSlab-Bold.ttf");

    tvTitle = (TextView) findViewById(R.id.tvTitle);
    tvTitle.setTypeface(fontBold);
    
    btnInfo = (ToggleButton) findViewById(R.id.btnInfo);
    
    tvIta = (TextView) findViewById(R.id.tvIta);
    tvIta.setTypeface(fontIta);
    
    tvEng = (TextView) findViewById(R.id.tvEng);
    tvEng.setTypeface(fontReg);
    
    tvMain = (TextView) findViewById(R.id.tvMain);

    btnInfo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                tvMain.setVisibility(View.INVISIBLE);
                btnAddFav.setVisibility(View.INVISIBLE);
                showInfo();
            } else {
                tvMain.setVisibility(View.VISIBLE);
                btnAddFav.setVisibility(View.VISIBLE);
                changeSays();
            }
        }
    });

    tvMain.setOnTouchListener(new OnSwipeTouchListener(MainActivity.this) {
        @Override
        public void onSwipeRight() {changeSays(); }
        @Override
        public void onSwipeLeft() { changeSays(); }
    });

    changeSays();
}
 
开发者ID:francescosoave,项目名称:TIS_android,代码行数:54,代码来源:MainActivity.java

示例14: onCreate

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.flightmap);
    m_gMap = getMap();
    EditText t = findViewById(R.id.txtMapRoute);

    ImageButton b = findViewById(R.id.btnUpdateMapRoute);
    b.setOnClickListener(this);

    ImageButton btnExport = findViewById(R.id.btnExportGPX);
    btnExport.setOnClickListener(this);

    ToggleButton tb = findViewById(R.id.ckShowAllAirports);
    tb.setOnCheckedChangeListener(this);
    tb.setSelected(m_fShowAllAirports);

    Intent i = getIntent();

    String szRoute = i.getStringExtra(ROUTEFORFLIGHT);
    t.setText(szRoute);

    long idPending = i.getLongExtra(PENDINGFLIGHTID, 0);
    int idExisting = i.getIntExtra(EXISTINGFLIGHTID, 0);
    long idNew = i.getIntExtra(NEWFLIGHTID, 0);

    if (idPending > 0) {
        m_le = new LogbookEntry(idPending);

        if (m_le.IsPendingFlight()) {
            this.m_rgFlightRoute = LocSample.samplesFromDataString(m_le.szFlightData);
            m_GPXPath = GPX.getFlightDataStringAsGPX(m_rgFlightRoute);    // initialize the GPX path
        }
    } else if (idExisting > 0) {
        m_le = RecentFlightsSvc.GetCachedFlightByID(idExisting);
        FetchFlightPathTask ffpt = new FetchFlightPathTask();
        new Thread(ffpt).start();
    } else if (idNew != 0) {
        m_le = MFBMain.getNewFlightListener().getInProgressFlight(this);
        this.m_rgFlightRoute = LocSample.flightPathFromDB();
        m_GPXPath = GPX.getFlightDataStringAsGPX(m_rgFlightRoute);    // initialize the GPX path.
    } else // all airports
    {
        t.setVisibility(View.GONE);
        b.setVisibility(View.GONE);
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:49,代码来源:ActFlightMap.java


注:本文中的android.widget.ToggleButton.setOnCheckedChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。