當前位置: 首頁>>代碼示例>>Java>>正文


Java ToggleButton.setOnClickListener方法代碼示例

本文整理匯總了Java中android.widget.ToggleButton.setOnClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ToggleButton.setOnClickListener方法的具體用法?Java ToggleButton.setOnClickListener怎麽用?Java ToggleButton.setOnClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ToggleButton的用法示例。


在下文中一共展示了ToggleButton.setOnClickListener方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btnRetrieve = (Button) findViewById(R.id.btnRetrieve);
    Switch_MQTT = (Switch) findViewById(R.id.switch_mqtt);
    btnControl_Green = (ToggleButton) findViewById(R.id.btnControl_Green);
    btnControl_Blue = (ToggleButton) findViewById(R.id.btnControl_Blue);
    textViewData = (TextView) findViewById(R.id.textViewData);

    btnRetrieve.setOnClickListener(this);
    Switch_MQTT.setOnCheckedChangeListener(this);
    btnControl_Green.setOnClickListener(this);
    btnControl_Blue.setOnClickListener(this);
    // Create AE and Get AEID

    GetAEInfo();
}
 
開發者ID:IoTKETI,項目名稱:oneM2M-Application-AndroidSample,代碼行數:19,代碼來源:MainActivity.java

示例2: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_blank);
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mScreenDensity = metrics.densityDpi;

    mMediaRecorder = new MediaRecorder();
    initRecorder();
    prepareRecorder();

    mProjectionManager = (MediaProjectionManager) getSystemService
            (Context.MEDIA_PROJECTION_SERVICE);

    mToggleButton = (ToggleButton) findViewById(R.id.toggle);
    mToggleButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onToggleScreenShare(v);
        }
    });

    mMediaProjectionCallback = new MediaProjectionCallback();
}
 
開發者ID:HitRoxxx,項目名稱:FloatingNew,代碼行數:26,代碼來源:RecordingScreen.java

示例3: setupToggleButton

import android.widget.ToggleButton; //導入方法依賴的package包/類
private void setupToggleButton(View view) {
    ToggleButton toggleButton =
            (ToggleButton) view.findViewById(R.id.toggle_select_all_categories);
    if (toggleButton != null) {
        toggleButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mCategoriesChecked = !mCategoriesChecked;
                setCategoriesChecked(mCategoriesChecked);
            }
        });
    }
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:14,代碼來源:FilterDialogFragment.java

示例4: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState) {
    Log.d("onCreate", "onCreate");
    super.onCreate(null);
    setContentView(R.layout.training_activity);
    toggleButton = (ToggleButton)findViewById(R.id.toggleButton);
    toggleButton.setOnClickListener(this);
    iterationView = (TextView)findViewById(R.id.textView);
    //iterationView.setMovementMethod(new ScrollingMovementMethod());
    accuracyView = (TextView)findViewById(R.id.accuracy);
    numIterations = (EditText)findViewById(R.id.editText);
}
 
開發者ID:chelexa,項目名稱:tensorflow-on-android,代碼行數:13,代碼來源:TrainingActivity.java

示例5: getView

import android.widget.ToggleButton; //導入方法依賴的package包/類
public View getView(LayoutInflater inflater, Setting setting, View convertView, Context context) {
	
	// reuse if view already created
	//if (mView != null) return mView;

	// re-create view every time to disable unwanted animation every time window is opened
	mSliderRenderer = null;
	mBaseRenderer = null;
	mChildView = -1;
	
	mInflater = inflater;
	mContext = context;
	mSetting = (RangeSetting) setting;
	RangeSetting rangeSetting = (RangeSetting) setting;
	
	LinearLayout view = /*mView =*/ (LinearLayout) inflater.inflate(R.layout.row_switchable_slider_view, null);
	
	ViewSwitcher switcher = mSwitcher = (ViewSwitcher) view.findViewById(R.id.switcher);
	switcher.setOutAnimation(AnimationUtils.loadAnimation(mContext, R.anim.slide_out_down));
	switcher.setInAnimation(AnimationUtils.loadAnimation(mContext, R.anim.slide_in_up));
	switcher.setAnimateFirstView(false);
	
	ToggleButton toggle = mToggle = (ToggleButton) view.findViewById(R.id.toggle);
	toggle.setOnClickListener(this);
	
	// initialize currently active view
	updateView(rangeSetting, toggle);
	
	return view;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:31,代碼來源:SwitchableSliderRenderer.java

示例6: getView

import android.widget.ToggleButton; //導入方法依賴的package包/類
public View getView(LayoutInflater inflater, Setting setting, View convertView, Context context) {

		// reuse if view exists
		if (mView != null) return mView;
		
		// create new view always. this is important for "dialog" mode
		mView = convertView = inflater.inflate(R.layout.row_setting_toggle, null); // inflate view of needed type
		
		// re-initialize views
		mTitle = (TextView) convertView.findViewById(R.id.title_view);
		mDescr = (TextView) convertView.findViewById(R.id.descr_view);
		mToggle = (ToggleButton) convertView.findViewById(R.id.clicable_right);
		mIcon = (ImageView) convertView.findViewById(R.id.icon_view);
		
		ImageButton button = (ImageButton) convertView.findViewById(R.id.popup_button);
		button.setVisibility(setting.hasPopup ? View.VISIBLE : View.GONE);
		LinearLayout clicableLeft = (LinearLayout) convertView.findViewById(R.id.clickable_left);
		
		// set listeners
		mToggle.setOnClickListener(this);
		button.setOnClickListener(this);
		clicableLeft.setOnClickListener(this);
		clicableLeft.setOnLongClickListener(setting.prefs == null ? null : this);

		// set values
		mSetting = setting;
		
		// update view
		updateView();
		
		return convertView;
	}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:33,代碼來源:ToggleSettingRenderer.java

示例7: 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

示例8: getView

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
    LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
    ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
    TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
    TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
    ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
    ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
    Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
    itemActuatorRun.setVisibility(View.GONE);

    final SensorInfo sensorInfo = sensorInfos.get(position);
    itemImageView.setImageResource(sensorInfo.getType().getImage());
    itemNameView.setText(sensorInfo.getType().getNickname());
    itemEnable.setChecked(sensorInfo.isEnable());
    if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
        itemStatus.setVisibility(View.GONE);
        itemActivate.setVisibility(View.GONE);
    }
    else {
        itemActivate.setEnabled(false);
        itemStatus.setText(sensorInfo.toString());
        itemActivate.setChecked(sensorInfo.isActivated());
    }

    // sensor item click
    itemLayout.setTag(sensorInfo);
    itemLayout.setOnClickListener(listItemClickListener);

    // sensor enable button click
    itemEnable.setTag(sensorInfo);
    itemEnable.setOnClickListener(enableClickListener);

    return rowView;
}
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:38,代碼來源:SensorListActivity.java

示例9: getView

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
            LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
            ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
            TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
            TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
            ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
            ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
            Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
            itemEnable.setVisibility(View.GONE);

            SensorInfo sensorInfo = sensorInfos.get(position);
            itemImageView.setImageResource(sensorInfo.getType().getImage());
            itemNameView.setText(sensorInfo.getType().getNickname());
//            itemEnable.setChecked(sensorInfo.isEnable());
            if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
                itemStatus.setVisibility(View.GONE);
                itemActivate.setVisibility(View.GONE);
                itemActuatorRun.setEnabled(sensorInfo.isActivated() && !sensorInfo.isSuspend());
            }
            else {
                itemActuatorRun.setVisibility(View.GONE);
                itemStatus.setText(sensorInfo.toString());
                itemActivate.setChecked(sensorInfo.isActivated());
                itemActivate.setEnabled(!sensorInfo.isSuspend());
            }

            // sensor item click
            itemLayout.setTag(sensorInfo);
            itemLayout.setOnClickListener(listItemClickListener);

            // sensor activation button click
            itemActivate.setTag(sensorInfo);
            itemActivate.setOnClickListener(activateClickListener);

            // actuator run button click
            itemActuatorRun.setTag(sensorInfo);
            itemActuatorRun.setOnClickListener(actuatorRunClickListener);

            return rowView;
        }
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:44,代碼來源:SensorListActivity.java

示例10: getView

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
            LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
            ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
            TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
            TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
            ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
            ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
            Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
            itemEnable.setVisibility(View.GONE);

            SensorInfo sensorInfo = sensorInfos.get(position);
            itemImageView.setImageResource(sensorInfo.getType().getImage());
            itemNameView.setText(sensorInfo.getType().getNickname());
//            itemEnable.setChecked(sensorInfo.isEnable());
            if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
                itemStatus.setVisibility(View.GONE);
                itemActivate.setVisibility(View.GONE);
                itemActuatorRun.setEnabled(!sensorInfo.isControlling()); // && !sensorInfo.isSuspend());
            }
            else {
                itemActuatorRun.setVisibility(View.GONE);
                itemStatus.setText(sensorInfo.toString());
                itemActivate.setChecked(sensorInfo.isActivated());
                itemActivate.setEnabled(!sensorInfo.isControlling()); // !sensorInfo.isSuspend());
            }

            // sensor item click
            itemLayout.setTag(sensorInfo);
            itemLayout.setOnClickListener(listItemClickListener);

            // sensor activation button click
            itemActivate.setTag(sensorInfo);
            itemActivate.setOnClickListener(activateClickListener);

            // actuator run button click
            itemActuatorRun.setTag(sensorInfo);
            itemActuatorRun.setOnClickListener(actuatorRunClickListener);

            return rowView;
        }
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-app-android,代碼行數:44,代碼來源:SensorListActivity.java


注:本文中的android.widget.ToggleButton.setOnClickListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。