当前位置: 首页>>代码示例>>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;未经允许,请勿转载。