答案 0 :(得分:3)
使用自定义seekbar
设置自己的背景和图标。
完全滑动seekbar
,seekbar.setVisibility(View.GONE);
和circle.setVisibility(View.VISIBLE);
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp" />
使用
android:thumb="@drawable/drag_thumb"
用你的拇指替换@drawable/drag_thumb
android:progressDrawable="@layout/custom_seekbar_layout"
创建自己的背景
android:max="YOUR_TOTAL_PROGRESS" <--replace YOUR_TOTAL_PROGRESS with your int -->
上课implements OnSeekBarChangeListener
和
seekBar=(SeekBar)findViewById(R.id.seekBar1);
seekBar.setOnSeekBarChangeListener(this);
现在管理活动
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
Toast.makeText(getApplicationContext(),"seekbar progress: "+progress, Toast.LENGTH_SHORT).show();
if(progress == YOUR_TOTAL_PROGRESS)
{
seekbar.setVisibility(View.GONE);
circle.setVisibility(View.VISIBLE);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
Toast.makeText(getApplicationContext(),"seekbar touch started!", Toast.LENGTH_SHORT).show();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Toast.makeText(getApplicationContext(),"seekbar touch stopped!", Toast.LENGTH_SHORT).show();
if (seekBar.getProgress() < YOUR_TOTAL_PROGRESS) {
seekBar.setProgress(0);
}
}
在seekbar
的完整幻灯片上,您可以为包含附加信息的布局(从底部显示“转移成功并包含按钮”)从下到上应用转换。
slide_in_top.xml:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:toYDelta="0%p"
android:duration="@android:integer/config_longAnimTime" />
slide_out_top.xml:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:toYDelta="100%p"
android:duration="@android:integer/config_longAnimTime" />