Animated SeekBar Animation

My problem is twofold. I have a seekBar until it is configured, but I am afraid that it will be necessary in the future. My problems surround the thumb image:

  • My seekBar icon should be accessible to the client, since I want the action to happen when I touch this one that was able to achieve using onTouchlistener. The problem is that I would like to get visual feedback feedback when I click the thumb. I tried this to achieve using the removable selector to no avail.

  • The second problem is that I want to animate my pointer on a change in orientation. I have no idea how to do this ...

Any help would be greatly appreciated!

EDIT: The animation I'm trying to achieve is a rotation, so the image will always be “upright”

and the code I tried to use for click feedback looks like this:

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/camera_button_feedback" android:state_pressed="true"/> <item android:drawable="@drawable/camera_button_feedback" android:state_selected="true"/> <item android:drawable="@drawable/camera_button_icon"/> </selector> 
+4
source share
3 answers

So, what I did after a long discussion, created a thumb view that was advanced by the thumb, and made the invisible thumb pointer invisible in order to receive touch events and simply animate the main view as needed

+2
source

Solving the problem 1.): I personally checked this, so I can assure that it works, and you WILL get visual feedback.

1.) Create a folder named "xml" in your project, and then add an XML file called thumb_drawable.xml to it. In this file, define the following:

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" android:drawable="@drawable/seek_thumb_pressed"> </item> <item android:drawable="@drawable/seek_thumb_normal"> </item> </selector> 

'seek_thumb_normal' is the default mouse pointer for Android, and the download link for this image is: http://www.tutomobile.fr/wp-content/uploads/2011/02/seek_thumb_normal.png . And "seek_thumb_pressed" is a modified version of the default thumb for scrolling for Android, which has only a different color. Now you can easily replace this with another desired image by placing this image in your folder with a selection, and then referring to this name.

2.) Here is the code I used to define the SeekBar in my layout file:

 <SeekBar android:id="@+id/seekbar" android:max="100" android:layout_width="fill_parent" android:layout_height="30dp" android:minWidth="30dp" android:minHeight="30dp" android:thumb="@xml/thumb_drawable"/> 

Problem 2: Now I'm a little confused because you said: "The animation I'm trying to achieve is a rotation, so the image will always be" vertical ", Android, by default, handles the rotation of the image when you change the orientation of the phone from portrait to the landscape, and thus the image is still vertical. I just checked it on an ice cream sandwich, and the turn indicator turned on its own when I changed orientation. if I didn’t understand or didn’t understand something else, you don't need to revive anything when the speech It is a question of orientation transformation. Let me know if you have something else, and I will help you solve it.

0
source

check out the following snippet that might help you a bit ...

  seekBar = (SeekBar)findViewById(R.id.seekBar); seekBar.setOnTouchListener(this); private void updateSeekProgress() { if (mediaPlayer.isPlaying()) { seekBar.setProgress((int)(((float)mediaPlayer.getCurrentPosition() / lengthOfAudio) * 100)); handler.postDelayed(r, 1000); } } 
-3
source

All Articles