android-seekbar
Custom seekbar thumb not transparent on Lollipop API21
The Material seek bar has split track enabled by default. You need to turn it off. <SeekBar …. android:splitTrack=”false” />
Android – How to change default SeekBar thickness?
You have to change progressDrawable and thumb of SeekBar to adjust it’s thickness : <SeekBar android:id=”@+id/seekBar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_below=”@id/indSeekBar” android:layout_marginTop=”48dp” android:progressDrawable=”@drawable/seek_bar” android:thumb=”@drawable/seek_thumb” /> Add in drawable folder seek_bar.xml : <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@android:id/background”> <shape android:shape=”line”> <stroke android:color=”@color/seek_bar_background” android:width=”@dimen/seek_bar_thickness”/> </shape> </item> <item android:id=”@android:id/secondaryProgress”> <clip> <shape android:shape=”line”> <stroke android:color=”@color/seek_bar_secondary_progress” android:width=”@dimen/seek_bar_thickness”/> </shape> </clip> </item> <item android:id=”@android:id/progress”> <clip> <shape … Read more
Android SeekBar thumb gets clipped/cut off
You should be able to fix this by setting paddingLeft and paddingRight on your SeekBar to half the thumb width (remember to use density-independent units). You can also control the space allowed at the edges for a seek bar’s thumb by calling setThumbOffset.
Changing step values in seekbar?
Try below code SeekBar seekBar = (SeekBar)layout.findViewById(R.id.seekbar); seekBar.setProgress(0); seekBar.incrementProgressBy(10); seekBar.setMax(200); TextView seekBarValue = (TextView)layout.findViewById(R.id.seekbarvalue); seekBarValue.setText(tvRadius.getText().toString().trim()); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){ @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { progress = progress / 10; progress = progress * 10; seekBarValue.setText(String.valueOf(progress)); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); setProgress(int) … Read more
SeekBar and media player in android
To create a ‘connection’ between SeekBar and MediaPlayer you need first to get your current recording max duration and set it to your seek bar. mSeekBar.setMax(mFileDuration/1000); // where mFileDuration is mMediaPlayer.getDuration(); After you initialise your MediaPlayer and for example press play button, you should create handler and post runnable so you can update your SeekBar … Read more
Android – styling seek bar
I would extract drawables and xml from Android source code and change its color to red. Here is example how I completed this for mdpi drawables: Custom red_scrubber_control.xml (add to res/drawable): <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:drawable=”@drawable/red_scrubber_control_disabled_holo” android:state_enabled=”false”/> <item android:drawable=”@drawable/red_scrubber_control_pressed_holo” android:state_pressed=”true”/> <item android:drawable=”@drawable/red_scrubber_control_focused_holo” android:state_selected=”true”/> <item android:drawable=”@drawable/red_scrubber_control_normal_holo”/> </selector> Custom: red_scrubber_progress.xml <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item android:id=”@android:id/background” android:drawable=”@drawable/red_scrubber_track_holo_light”/> <item android:id=”@android:id/secondaryProgress”> … Read more