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


Java SeekBar類代碼示例

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


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

示例1: getPanel

import android.widget.SeekBar; //導入依賴的package包/類
private ViewGroup getPanel(Context context, int type) {
    final ViewGroup mViewGroup = new LinearLayout(context);
    LinearLayout.LayoutParams btnParam =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    //   btnParam.weight = 1;
    btnParam.gravity = Gravity.CENTER_VERTICAL;
    LinearLayout.LayoutParams seekBarParam =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    seekBarParam.weight = 1;
    seekBarParam.gravity = Gravity.CENTER;

    ImageButton btnBack = new ImageButton(context);
    btnBack.setImageBitmap(backBitmap);
    btnBack.setScaleType(ImageView.ScaleType.FIT_CENTER);
    btnBack.setBackgroundColor(Color.alpha(255));

    SeekBar seekBar = getSeekBar(context, type);

    ImageButton btnFunc = new ImageButton(context);
    btnFunc.setImageBitmap(funcBitmap);
    btnFunc.setScaleType(ImageView.ScaleType.FIT_CENTER);
    btnFunc.setBackgroundColor(Color.alpha(255));

    mViewGroup.addView(btnBack, btnParam);
    mViewGroup.addView(seekBar, seekBarParam);
    mViewGroup.addView(btnFunc, btnParam);

    final WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mViewGroup.setBackgroundColor(Color.BLACK);
    btnBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            wm.removeView(mViewGroup);
        }
    });

    return mViewGroup;
}
 
開發者ID:EggUncle,項目名稱:XposedNavigationBar,代碼行數:39,代碼來源:LightAndVolumeController.java

示例2: onStartTrackingTouch

import android.widget.SeekBar; //導入依賴的package包/類
public void onStartTrackingTouch(SeekBar bar) {

            mHandler.removeMessages(MSG_HIDE_CONTROLLER);


            mDragging = true;
            mSeekComplete = false;

            // By removing these pending progress messages we make sure
            // that a) we won't update the progress while the user adjusts
            // the seekbar and b) once the user is done dragging the thumb
            // we will post one of these messages to the queue again and
            // this ensures that there will be exactly one message queued up.
            if (Player.sPlayer.isPlaying()) {
                mSeekWasPlaying = true;
                Player.sPlayer.pause();
            }
            else
                mSeekWasPlaying=false;
        }
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:21,代碼來源:FloatingPlayerService.java

示例3: onProgressChanged

import android.widget.SeekBar; //導入依賴的package包/類
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (videoMediaPlayer == null) {
        return;
    }

    if (!fromUser) {
        // We're not interested in programmatically generated changes to
        // the progress bar's position.
        return;
    }

    long duration = videoMediaPlayer.getDuration();
    long newPosition = (duration * progress) / Constants.ONE_MILLISECOND;
    videoMediaPlayer.seekTo((int) newPosition);
    if (currentTime != null) {
        currentTime.setText(stringForTime((int) newPosition));
    }
}
 
開發者ID:dev-labs-bg,項目名稱:fullscreen-video-view,代碼行數:20,代碼來源:VideoControllerView.java

示例4: bindViews

import android.widget.SeekBar; //導入依賴的package包/類
private void bindViews() {

        selectedColorPreview = findViewById(R.id.selected_color_preview);

        seekBarRed = (SeekBar) findViewById(R.id.seekbar_red);
        seekBarRed.setMax(COLOR_MAX_VALUE);
        seekBarRed.setOnSeekBarChangeListener(this);
        seekBarBlue = (SeekBar) findViewById(R.id.seekbar_blue);
        seekBarBlue.setMax(COLOR_MAX_VALUE);
        seekBarBlue.setOnSeekBarChangeListener(this);
        seekBarGreen = (SeekBar) findViewById(R.id.seekbar_green);
        seekBarGreen.setMax(COLOR_MAX_VALUE);
        seekBarGreen.setOnSeekBarChangeListener(this);
        seekBarAlpha = (SeekBar) findViewById(R.id.seekbar_alpha);
        seekBarAlpha.setMax(COLOR_MAX_VALUE);
        seekBarAlpha.setProgress(COLOR_MAX_VALUE);
        seekBarAlpha.setOnSeekBarChangeListener(this);
    }
 
開發者ID:Codigami,項目名稱:CFAlertDialog,代碼行數:19,代碼來源:ColorSelectionView.java

示例5: initStokeWidthPopWindow

import android.widget.SeekBar; //導入依賴的package包/類
private void initStokeWidthPopWindow() {
    popView = LayoutInflater.from(activity).
            inflate(R.layout.view_set_stoke_width, null);
    setStokenWidthWindow = new PopupWindow(popView, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    mStokenWidthSeekBar = (SeekBar) popView.findViewById(R.id.stoke_width_seekbar);

    setStokenWidthWindow.setFocusable(true);
    setStokenWidthWindow.setOutsideTouchable(true);
    setStokenWidthWindow.setBackgroundDrawable(new BitmapDrawable());
    setStokenWidthWindow.setAnimationStyle(R.style.popwin_anim_style);


    mPaintModeView.setPaintStrokeColor(Color.RED);
    mPaintModeView.setPaintStrokeWidth(10);

    updatePaintView();
}
 
開發者ID:viseator,項目名稱:MontageCam,代碼行數:20,代碼來源:PaintFragment.java

示例6: onCreateDialog

import android.widget.SeekBar; //導入依賴的package包/類
@SuppressLint("InflateParams")
public Dialog onCreateDialog() {
    tgPlayRateList = generatePercent();

    final View view = getActivity().getLayoutInflater().inflate(R.layout.view_toolbar_playrate_dialog, null);
    this.seekBar = (SeekBar) view.findViewById(R.id.toolbar_percent_seekbar);
    this.textView = (TextView) view.findViewById(R.id.toolbar_percent_textview);

    this.seekBar.setMax(tgPlayRateList.size() - 1);
    this.initPlayRate();
    this.appendListeners(seekBar);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.toolbar_playrate_dlg_title);
    builder.setView(view);
    return builder.create();
}
 
開發者ID:axlecho,項目名稱:tuxguitar,代碼行數:18,代碼來源:TGToolbarPlayRateDialog.java

示例7: onFinishInflate

import android.widget.SeekBar; //導入依賴的package包/類
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group);
    mColorModeButtons.put(Theme.LIGHT,
            initializeAndGetButton(R.id.light_mode, Theme.LIGHT));
    mColorModeButtons.put(Theme.DARK,
            initializeAndGetButton(R.id.dark_mode, Theme.DARK));
    mColorModeButtons.put(Theme.SEPIA,
            initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA));
    mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true);

    mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size);
    mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage);

    mFontFamilySpinner = (Spinner) findViewById(R.id.font_family);
    initFontFamilySpinner();

    // Setting initial progress on font scale seekbar.
    onChangeFontScaling(mDistilledPagePrefs.getFontScaling());
    mFontScaleSeekBar.setOnSeekBarChangeListener(this);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:DistilledPagePrefsView.java

示例8: startWithDefaultProperty

import android.widget.SeekBar; //導入依賴的package包/類
@Test
public void startWithDefaultProperty() throws Exception
{
    Property property = new Property();

    ActivityController controller = startWithProperty(property);
    Activity activity = (Activity)controller.get();
    SeekBar yearSeeker = (SeekBar)activity.findViewById(R.id.yearSeeker);

    // The first shown year should be year 1, or index 0.
    assertEquals(0, yearSeeker.getProgress());

    Map<Integer, String> expectedValues = new ImmutableMap.Builder<Integer, String>()
            .put(R.id.rentValue, "0")
            .put(R.id.vancancyValue, "0")
            .put(R.id.operatingIncomeValue, "0")
            .put(R.id.operatingExpensesValue, "0")
            .put(R.id.netOperatingIncomeValue, "0")
            .put(R.id.mortgageValue, "0")
            .put(R.id.cashFlowValue, "0")
            .put(R.id.afterTaxCashFlowValue, "0")
            .put(R.id.propertyValueValue, "0")
            .put(R.id.loanBalanceValue, "0")
            .put(R.id.totalEquityValue, "0")
            .put(R.id.depreciationValue, "0")
            .put(R.id.mortgageInterestValue, "0")
            .put(R.id.capitalizationRateValue, "0.0")
            .put(R.id.cashOnCashValue, "0.0")
            .put(R.id.rentToValueValue, "0.0")
            .put(R.id.grossRentMultiplierValue, "0.0")
            .build();

    checkFields(activity, expectedValues);
}
 
開發者ID:brarcher,項目名稱:rental-calc,代碼行數:35,代碼來源:PropertyProjectionsActivityTest.java

示例9: onStartTrackingTouch

import android.widget.SeekBar; //導入依賴的package包/類
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
    Log.i(TAG, "bottomProgress onStartTrackingTouch [" + this.hashCode() + "] ");
    cancelProgressTimer();
    ViewParent vpdown = getParent();
    while (vpdown != null) {
        vpdown.requestDisallowInterceptTouchEvent(true);
        vpdown = vpdown.getParent();
    }
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:11,代碼來源:JCVideoPlayer.java

示例10: onStopTrackingTouch

import android.widget.SeekBar; //導入依賴的package包/類
public void onStopTrackingTouch(SeekBar bar) {

      if (!mInstantSeeking) {
        mPlayer.seekTo((mDuration * bar.getProgress()) / 1000);
      }
      if (mInfoView != null) {
        mInfoView.setText("");
        mInfoView.setVisibility(View.GONE);
      }
      show(sDefaultTimeout);
      mHandler.removeMessages(SHOW_PROGRESS);
      mAM.setStreamMute(AudioManager.STREAM_MUSIC, false);
      mDragging = false;
      mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);
    }
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:16,代碼來源:MediaController.java

示例11: onBindView

import android.widget.SeekBar; //導入依賴的package包/類
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    getPreferenceManager().registerOnActivityStopListener(this);

    initHandler();

    final SeekBar seekBar = (SeekBar) view.findViewById(R.id.start_volume);
    if (seekBar == mStartVolumeSeekBar) return;

    mStartVolumeSeekBar = seekBar;
    mRampUpTimeSeekBar = (SeekBar) view.findViewById(R.id.ramp_up_time);
    mRampUpTimeValue = (TextView) view.findViewById(R.id.ramp_up_time_value);

    final ContentResolver cr = getContext().getContentResolver();
    float startVolume = CMSettings.System.getFloat(cr,
            CMSettings.System.INCREASING_RING_START_VOLUME, 0.1f);
    int rampUpTime = CMSettings.System.getInt(cr,
            CMSettings.System.INCREASING_RING_RAMP_UP_TIME, 10);

    mStartVolumeSeekBar.setProgress(Math.round(startVolume * 1000F));
    mStartVolumeSeekBar.setOnSeekBarChangeListener(this);
    mRampUpTimeSeekBar.setOnSeekBarChangeListener(this);
    mRampUpTimeSeekBar.setProgress((rampUpTime / 5) - 1);
    mRampUpTimeValue.setText(
            Formatter.formatShortElapsedTime(getContext(), rampUpTime * 1000));
}
 
開發者ID:ric96,項目名稱:lineagex86,代碼行數:28,代碼來源:IncreasingRingVolumePreference.java

示例12: onStopTrackingTouch

import android.widget.SeekBar; //導入依賴的package包/類
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    if (!mInstantSeeking)
        mPlayerListener.seekTo(mDuration * seekBar.getProgress() / 1000);
    if (mInfoView != null){
        mInfoView.setText("");
        mInfoView.setVisibility(GONE);
    }
    show(sDefaultTimeout);
    mHandler.removeMessages(SHOW_PROGRESS);
    mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, false);
    mDragging = false;
    mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:15,代碼來源:MediaController.java

示例13: onStopTrackingTouch

import android.widget.SeekBar; //導入依賴的package包/類
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    long duration = mediaPlayer.getDuration();
    long newPosition = (duration * seekBar.getProgress()) / videoProgress.getMax();
    mediaPlayer.seekTo((int) newPosition);
    isDragging = false;
    post(mShowProgress);
    show();
}
 
開發者ID:dueeeke,項目名稱:dkplayer,代碼行數:10,代碼來源:FullScreenController.java

示例14: AudioView

import android.widget.SeekBar; //導入依賴的package包/類
public AudioView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  inflate(context, R.layout.audio_view, this);

  this.container        = (ViewGroup) findViewById(R.id.audio_widget_container);
  this.controlToggle    = (AnimatingToggle) findViewById(R.id.control_toggle);
  this.playButton       = (ImageView) findViewById(R.id.play);
  this.pauseButton      = (ImageView) findViewById(R.id.pause);
  this.downloadButton   = (ImageView) findViewById(R.id.download);
  this.downloadProgress = (ProgressWheel) findViewById(R.id.download_progress);
  this.seekBar          = (SeekBar) findViewById(R.id.seek);
  this.timestamp        = (TextView) findViewById(R.id.timestamp);

  this.playButton.setOnClickListener(new PlayClickedListener());
  this.pauseButton.setOnClickListener(new PauseClickedListener());
  this.seekBar.setOnSeekBarChangeListener(new SeekBarModifiedListener());

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    this.playButton.setImageDrawable(context.getDrawable(R.drawable.play_icon));
    this.pauseButton.setImageDrawable(context.getDrawable(R.drawable.pause_icon));
    this.playButton.setBackground(context.getDrawable(R.drawable.ic_circle_fill_white_48dp));
    this.pauseButton.setBackground(context.getDrawable(R.drawable.ic_circle_fill_white_48dp));
  }

  if (attrs != null) {
    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AudioView, 0, 0);
    setTint(typedArray.getColor(R.styleable.AudioView_foregroundTintColor, Color.WHITE),
            typedArray.getColor(R.styleable.AudioView_backgroundTintColor, Color.WHITE));
    container.setBackgroundColor(typedArray.getColor(R.styleable.AudioView_widgetBackground, Color.TRANSPARENT));
    typedArray.recycle();
  }
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:33,代碼來源:AudioView.java

示例15: updateView

import android.widget.SeekBar; //導入依賴的package包/類
private void updateView() {
    mSwitchBeauty.setImageResource(isOpen ? R.drawable.kai : R.drawable.guan);
    for (SeekBarRow row : seekBarRowList) {
        SeekBar seekBar = row.seekBar;
        seekBar.setEnabled(isOpen);
    }
}
 
開發者ID:pili-engineering,項目名稱:PLDroidShortVideo,代碼行數:8,代碼來源:EyeAndThinView.java


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