seekbar

seekbar thumb center not at the start point

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: as my pic,the seekbar progress =0,but the seekbar thumb center not at the start point.my code: <SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:progressDrawable="@drawable/seekbar_progress" android:thumb="@drawable/seekbarthumb" android:minHeight="10dip" android:maxHeight="10dip" android:thumbOffset="0px" android:max="100" android:id="@+id/bright_seekbar" android:layout_marginLeft="60dip"/> seekbar_progress <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com

Android - Custom SeekBar - round corners on progress bar

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Trying to make a custom SeekBar. I want to achieve this. What I have done so far is this. I can't find a way to round the corners on the progress bar. Can someone help with this? Here is my code main_activity.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center"> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="30dp" android:progressDrawable="

Animate seekbar progress

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a screen with 4 seek bars ( As shown in the image below) . If the user moves B,C or D I calculate the average of the three and setProgress of A to the average. That was the easy part . What I would like to do is animate the progress bar A such that it does not jump in one shot (for eg from 25-75 ). What are the recommended ways to animate A? I got a simple animation up but I am calling a TimerTask every 50ms to increment or decrement A by a unit value till I reach the required position. But its not very efficient. Note: I have a

Android seekbar with custom thumb having dynamic text inside it

岁酱吖の 提交于 2019-12-03 06:39:49
I want to create android custom SeekBar having thumb with text inside it to show current seek position. Here is my code: SeekBar sb; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.custom_seek_bar_activity); sb = (SeekBar)findViewById(R.id.slider); sb.setMax(100); sb.setProgress(10); BitmapDrawable bd = writeOnDrawable(R.drawable.star2, Double.toString(50)); sb.setThumb(bd); sb.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){ @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {

Android Seekbar float values from 0.0 to 2.0

有些话、适合烂在心里 提交于 2019-12-03 06:30:51
how can I get the values ​​from 0.0 to 2.0 with a seekbar ? values ​​should go in steps of 0.5 ( 0.0 , 0.5 , 1.0, 1.5, 2.0) can someone help me? SeekBar extends ProgressBar. ProgressBar has a method public void setMax(int max) Since it only accepts int you'll have to do some conversion from an int value to get the float that you are after. Something like this should do the trick: mSeekBar.setMax(4); //max = 4 so the possible values are 0,1,2,3,4 seekbar.setOnSeekBarChangeListener( new OnSeekBarChangeListener(){ public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { //

Espresso - Set SeekBar

 ̄綄美尐妖づ 提交于 2019-12-03 06:05:08
does anybody know, how to set a seekBar to a specific value or just a click on that view on Espresso UI Testing ? I just get an exception: Error performing 'single click' on view with id... onView(withId(R.id.FilterPriceMax)).perform(click()); I use a swipe-action to perform an actual swipe on the SeekBar . This makes sure the callback method ( SeekBar.OnSeekBarChangeListener. onProgressChanged ) is called with fromUser set to true. It is also more in the line of click testing. public static ViewAction scrubSeekBarAction(int progress) { return actionWithAssertions(new GeneralSwipeAction( Swipe

Detecting thumb position in SeekBar prior to API version 16

主宰稳场 提交于 2019-12-03 05:26:10
Basically, I need to detect when the progress changes in the SeekBar and draw a text view on top of the thumb indicating the progress value. I do this by implementing a OnSeekBarChangeListener and on the public void onProgressChanged(SeekBar seekBar, int progress, boolean b) method, I call Rect thumbRect = seekBar.getThumb().getBounds(); to determine where the thumb is positioned. This works perfectly fine, but apparently getThumb() is only available in API level 16+ (Android 4.1), causing a NoSuchMethodError on earlier versions. Any idea how to work around this issue? I was able to use my own

Android seekbar how to block dragging / disable it for short time

不问归期 提交于 2019-12-03 05:19:45
I want to block the dragging of a seekbar if a value is true. Is this even possible? I use a seekbar as a switch. If my seekbar value is 0, and I press the button action A started. If my seekbar value is 1 and I press the button action B is started. I want to prevent that If action A or B is running the seekbar is dragged to another position. How can I achieve this? You should set your own onTouchListener and just return true. seekBar.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { return true; } }); JoxTraex Have you tried

Mediaplayer progress update to seekbar not smooth?

有些话、适合烂在心里 提交于 2019-12-03 05:06:17
问题 I am working on an app with recorder and player. I am using mediaplayer to play the recorded .wav file and meantime I want to update to a seekbar. Everything is working fine But my problem is mediaplayer progress updation to seekbar is not happening smoothly, If we are playig a small file, thumb of the seekbar jumps in seconds or between. Can anyone help me with a workaround to make it smooth seeking of the progress in seekbar. My code is shown below.I am totlay stuck here. mediaPlayerIntiate

Android MediaPlayer Error (-38, 0) “stop called in state 0”

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have looked at various different websites looking for a solution for this problem in my code. It is a basic audio player with 3 buttons: play, pause and stop. Play and pause work ok and so does stop but once the audio has been stopped it refuses to start again, throwing an error: E/MediaPlayer: stop called in state 0 E/MediaPlayer: error (-38, 0) E/MediaPlayer: Error (-38,0) This is my MainActivity.java: import android.app.Activity; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.os