【Android】PreviewSeekBar使用

前言

PreviewSeekBar的使用。

适合用于显示预览是SeekBar。如在谷歌播放的电影。 Google Play Movies如下: 输入图片说明

PreviewSeekBar's sample如下: 输入图片说明

Build

dependencies {
    compile 'com.github.rubensousa:previewseekbar:0.3'
}

How to use Add the following XML:

<com.github.rubensousa.previewseekbar.PreviewSeekBarLayout
      android:id="@+id/previewSeekBarLayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">

      <FrameLayout
          android:id="@+id/previewFrameLayout"
          android:layout_width="@dimen/video_preview_width"
          android:layout_height="@dimen/video_preview_height">

          <View
              android:id="@+id/videoView"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              android:background="@color/colorPrimary" />

      </FrameLayout>

      <com.github.rubensousa.previewseekbar.PreviewSeekBar
          android:id="@+id/previewSeekBar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/previewFrameLayout"
          android:layout_marginTop="25dp"
          android:max="800" />

</com.github.rubensousa.previewseekbar.PreviewSeekBarLayout>

你需要添加至少一个PreviewSeekBar 或者FrameLayout在PreviewSeekBarLayout,否则将抛出一个异常。

Pass a standard OnSeekBarChangeListener to the seekBar:

// setOnSeekBarChangeListener was overridden to do the same as below
seekBar.addOnSeekBarChangeListener(this);

Implement your own preview logic in:

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    // I can't help anymore
}

参考:https://github.com/rubensousa/PreviewSeekBar

转载于:https://my.oschina.net/huangxianfeng/blog/852798

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值