animationdrawable

AnimationDrawable in RecyclerView item not animating on notifyDataSetChanged

可紊 提交于 2020-01-06 03:10:14
问题 I have a recyclerview whenever i select an item in recyclerview to play music i need to animate my AnimationDrawable equalizer of selected item but it is not animating when i call notifyDataSetChanged to refresh my view to show equalizer on selected item. 来源: https://stackoverflow.com/questions/47574529/animationdrawable-in-recyclerview-item-not-animating-on-notifydatasetchanged

Removing the background of a frame animation in Android

主宰稳场 提交于 2019-12-23 12:33:00
问题 How can I remove the background of a frame animation (or set it to be transparent )? When I set the background colour in the xml layout file to be transparent, it turns up black when running it. When I setBackgroundColor(0); in the Java code I get the following exception : java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.graphics.drawable.AnimationDrawable /res/layout/dialog_loading.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns

Loop animation drawable

我的未来我决定 提交于 2019-12-23 01:12:07
问题 I'm trying to animate some png and i would loop the animation. This is my code: wave.setBackgroundResource(R.drawable.wave_animation); frameAnimation = (AnimationDrawable)wave.getBackground(); frameAnimation.setCallback(wave); frameAnimation.setVisible(true, true); frameAnimation.start(); and here the xml with the png <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@drawable/wave_01" android:duration="200" /> <item

Android: AnimationDrawable cast error

≡放荡痞女 提交于 2019-12-22 03:40:26
问题 I was following the Google provided example of how to use AnimationDrawable with an ImageView. You can find it here: http://developer.android.com/guide/topics/graphics/drawable-animation.html imageView.setBackgroundResource(R.drawable.animation); AnimationDrawable animation = (AnimationDrawable)imageView.getBackground(); animation.start(); When I run it I get the error: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.graphics.drawable

Android: AnimationDrawable cast error

人盡茶涼 提交于 2019-12-22 03:39:02
问题 I was following the Google provided example of how to use AnimationDrawable with an ImageView. You can find it here: http://developer.android.com/guide/topics/graphics/drawable-animation.html imageView.setBackgroundResource(R.drawable.animation); AnimationDrawable animation = (AnimationDrawable)imageView.getBackground(); animation.start(); When I run it I get the error: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.graphics.drawable

android live wallpapers parallax-scrolling effect

大憨熊 提交于 2019-12-20 05:41:41
问题 when we scroll, the foreground of the home screen (icons, widgets, etc.) moves to the left or right by the full screen width, but the background image (or live wallpaper) only moves by a fraction of that width. My question is how get this effect. till now have done this. SurfaceHolder holder = getSurfaceHolder(); Canvas canvas = null; try { canvas = holder.lockCanvas(); if (canvas != null) { drawCircles(canvas); } } finally { if (canvas != null) holder.unlockCanvasAndPost(canvas); } the draw

Android Multilevel expandable list view set third level child item clicked

给你一囗甜甜゛ 提交于 2019-12-18 09:38:10
问题 i have codes from this project, and i want to implement expandable third level child OnItemClick, i tried to use concept from this 2 level expandablelistview child click listener but it did not work. SO how can i make user know has selected certain parent/group level, second level and third level items. here is my codes: MainPageActivity.java public class MainPageActivity extends AppCompatActivity { private ExpandableListView expandableListView; String[] parent = new String[]{"group 1",

How to animate .gif images in an android?

怎甘沉沦 提交于 2019-12-17 15:41:44
问题 Here is the code for xml: <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/minepic" /> Here the minepic is a gif animated image but after running the application its just showing a static image. Is there any solution about how to animate the .gif images in android application? 回答1: To give a precise and complete answer here is what you need to do step wise: You would need to have different .png images which

Start AnimationDrawable at specific frame?

那年仲夏 提交于 2019-12-13 04:48:43
问题 I got an AnimationDrawable like so: AnimationDrawable ani = new AnimationDrawable(); ani.addFrame(first, duration); ani.addFrame(second, duration); ani.addFrame(third, duration); ani.setOneShot(true); And started like so: ani.start(); I was wondering if it is possible to start directly, at lets say the second frame. Are there any ways of doing this? I need it for a game where I want to be able to resume the exact frame as when I hit my pause button calling: ani.stop(); For now it starts the

running 2 animationDrawables at the same time

陌路散爱 提交于 2019-12-12 04:43:46
问题 hey everyone hope u can help n thanks 4 looking here is my code for 2 spinning coins, but only coin1 spins....is it because they both refrence the same xml animation file or something else? public class MainActivity extends Activity { static AnimationDrawable frameAnimation; static AnimationDrawable frameAnimation2; ImageView coinAnima2; ImageView coinAnima; public boolean currentSpin = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);