Code example for ToggleButton

Methods: toggle

0
 
		mToogleButton.setOnCheckedChangeListener(new ToggleListener());
	} 
 
	public void toggle() { 
		mToogleButton.toggle();
	} 
 
	class ToggleListener implements OnCheckedChangeListener {
 
		@Override 
		public void onCheckedChanged(CompoundButton buttonView,
				boolean isChecked) {
 
			// 保存设置 
			SettingUtils.set(mContext, key, isChecked);
			// 播放动画 
			RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mImageButton
					.getLayoutParams();
			if (isChecked) {
				// 调整位置