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


Java ToggleButton类代码示例

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


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

示例1: initViews

import android.widget.ToggleButton; //导入依赖的package包/类
@Override
protected void initViews(View view) {
    super.initViews(view);
    timerChronometer = (Chronometer) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.chronometer_timer_audio_call);

    ImageView firstOpponentAvatarImageView = (ImageView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.image_caller_avatar);
    firstOpponentAvatarImageView.setBackgroundDrawable(UiUtils.getColorCircleDrawable(opponents.get(0).getId()));

    alsoOnCallText = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_also_on_call);
    setVisibilityAlsoOnCallTextView();

    firstOpponentNameTextView = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_caller_name);
    firstOpponentNameTextView.setText(opponents.get(0).getFullName());

    otherOpponentsTextView = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_other_inc_users);
    otherOpponentsTextView.setText(getOtherOpponentsNames());

    audioSwitchToggleButton = (ToggleButton) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.toggle_speaker);
    audioSwitchToggleButton.setVisibility(View.VISIBLE);

    actionButtonsEnabled(false);
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:23,代码来源:AudioConversationFragment.java

示例2: onCreate

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

    biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
    chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
    earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
    energyButton = (ToggleButton) findViewById(R.id.energyButton);
    mathButton = (ToggleButton) findViewById(R.id.mathButton);
    physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
    randomButton = (ToggleButton) findViewById(R.id.randomButton);

    roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
    roundNumPicker.setMinValue(0);
    roundNumPicker.setMaxValue(roundOptions.length-1);
    roundNumPicker.setWrapSelectorWheel(false);
    roundNumPicker.setDisplayedValues(roundOptions);

    menuButton = (Button) findViewById(R.id.menuButton);
}
 
开发者ID:jakepolatty,项目名称:HighSchoolScienceBowlPractice-Android,代码行数:22,代码来源:StudyModeSettingsPage.java

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

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

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

示例6: AnimationControlsManager

import android.widget.ToggleButton; //导入依赖的package包/类
public AnimationControlsManager(
    AnimatedDrawable2 animatedDrawable,
    @Nullable SeekBar seekBar,
    @Nullable ToggleButton playPauseToggleButton,
    @Nullable View resetButton) {
  mAnimatedDrawable = animatedDrawable;
  mSeekBar = seekBar;
  mPlayPauseToggleButton = playPauseToggleButton;
  mResetButton = resetButton;

  setupPlayPauseToggleButton();
  setupResetButton();
  setupSeekBar();

  mAnimatedDrawable.setAnimationListener(mAnimationListener);
  updateBackendData(mAnimatedDrawable.getAnimationBackend());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:AnimationControlsManager.java

示例7: onViewCreated

import android.widget.ToggleButton; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  ImageView imageView = (ImageView) view.findViewById(R.id.animation_container);

  // Create a new animated drawable. The backend will be set by the backend configurator.
  mAnimatedDrawable = new AnimatedDrawable2();

  imageView.setImageDrawable(mAnimatedDrawable);

  mAnimationControlsManager = new AnimationControlsManager(
      mAnimatedDrawable,
      (SeekBar) view.findViewById(R.id.seekbar),
      (ToggleButton) view.findViewById(R.id.playpause),
      view.findViewById(R.id.reset));

  new SampleAnimationBackendConfigurator(
      (Spinner) view.findViewById(R.id.spinner),
      this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:MediaControlFragment.java

示例8: initializeViews

import android.widget.ToggleButton; //导入依赖的package包/类
private void initializeViews(Dialog dialog) {
    major = (ToggleButton) dialog.findViewById(R.id.major);
    minor = (ToggleButton) dialog.findViewById(R.id.minor);
    dialog.findViewById(R.id.major_parent).setOnClickListener(__ -> onMajorClicked());
    dialog.findViewById(R.id.minor_parent).setOnClickListener(__ -> onMinorClicked());

    keySigImage = (ImageView) dialog.findViewById(R.id.key_sig_image);

    key = (NumberPicker) dialog.findViewById(R.id.key);
    key.setWrapSelectorWheel(false);
    key.setMinValue(0);
    key.setMaxValue(KeySigHandler.FIFTHS.length - 1);

    major.setChecked(false);
    onMajorClicked();
    key.setOnValueChangedListener(this);
    key.setValue(6);
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:19,代码来源:KeySigDialogFragment.java

示例9: mute

import android.widget.ToggleButton; //导入依赖的package包/类
public void mute(final View v) {
    final NextAction dumbaction = new NextAction() {
        public void run(String res) {}
    };
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            ToggleButton tb = (ToggleButton)v;
            if (tb.isChecked()) {
                connect.muteUser(VisuUser.curuserid, dumbaction);
                message("muting user "+VisuUser.curuserid);
            } else {
                connect.unmuteUser(VisuUser.curuserid, dumbaction);
                message("unmuting user "+VisuUser.curuserid);
            }
        }
    });
}
 
开发者ID:cerisara,项目名称:mousetodon,代码行数:19,代码来源:MouseApp.java

示例10: onCreate

import android.widget.ToggleButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_track);
    tbTrack = (ToggleButton) findViewById(R.id.tb_track);
    tvMessage = (TextView) findViewById(R.id.tv_location_message);

    tbTrack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startTrack();
            } else {
                stopTrack();
            }
        }

    });
}
 
开发者ID:dreamfish797,项目名称:LocationProvider,代码行数:20,代码来源:LocationTrackActivity.java

示例11: follow

import android.widget.ToggleButton; //导入依赖的package包/类
public void follow(final View v) {
    final NextAction dumbaction = new NextAction() {
        public void run(String res) {}
    };
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            ToggleButton tb = (ToggleButton)v;
            if (tb.isChecked()) {
                connect.followUser(VisuUser.curuserid, dumbaction);
                message("following user "+VisuUser.curuserid);
            } else {
                connect.unfollowUser(VisuUser.curuserid, dumbaction);
                message("unfollowing user "+VisuUser.curuserid);
            }
        }
    });
}
 
开发者ID:cerisara,项目名称:mousetodon,代码行数:19,代码来源:MouseApp.java

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

示例13: selectQuadrant

import android.widget.ToggleButton; //导入依赖的package包/类
/**
 * Select a Quadrant, and update the ToggleButtons to reflect user choice.
 *
 * @param n Selected Quadrant
 */
protected void selectQuadrant(int n) {
  // Set selectedQuadrant to what the user chose
  selectedQuadrant = n;

  // Create an array of the ToggleButtons for easy updating
  ToggleButton[] arr = {quadOne, quadTwo, quadThree, quadFour};

  // Update the ToggleButtons based on if they were selected or not
  for (int i = 0; i < arr.length; i++) {
    if (i == selectedQuadrant) {
      arr[i].setChecked(true);
    } else {
      arr[i].setChecked(false);
    }
  }
}
 
开发者ID:Austin-Ray,项目名称:Hexis,代码行数:22,代码来源:ModifyItemDialogFragment.java

示例14: onCreate

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

    biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
    chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
    earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
    energyButton = (ToggleButton) findViewById(R.id.energyButton);
    mathButton = (ToggleButton) findViewById(R.id.mathButton);
    physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
    randomButton = (ToggleButton) findViewById(R.id.randomButton);

    tossupTimeSpinner = (Spinner) findViewById(R.id.tossupTimeSelector);
    bonusTimeSpinner = (Spinner) findViewById(R.id.bonusTimeSelector);

    menuButton = (Button) findViewById(R.id.menuButton);
}
 
开发者ID:jakepolatty,项目名称:HighSchoolScienceBowlPractice-Android,代码行数:19,代码来源:QuizModeSettingsPage.java

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


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