android-animation

ImageSwitcher is not showing outAnimation

爷,独闯天下 提交于 2019-12-24 19:45:11
问题 I'm using ImageSwitcher widget of android to transition between 2 images like a slide show but it is showing only in animation and out animation is not showing. What is the issue? Code: imageSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { RoundedImageView imageView = new RoundedImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setLayoutParams(new ImageSwitcher.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT,

Animation of nested fragment within ViewPager fragment is triggered before render

旧街凉风 提交于 2019-12-24 18:31:03
问题 I have a ViewPager fragment class PagerFragment() : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val pagerView = view as ViewPager val adapter = PagerAdapter(childFragmentManager, items) pagerView.adapter = adapter } } with the following adapter class PagerAdapter(val fm: FragmentManager, val items: ArrayList<Item>) : FragmentStatePagerAdapter(fm) { override fun getItem(position: Int): Fragment { val item =

Animating Android ListView view on touch

ぃ、小莉子 提交于 2019-12-24 12:28:25
问题 I'd like to animate item in ListView when user touches the item and do the animation backwards when the touch have ended. I've tried doing it by overriding onTouchEvent of the list item but if I return true when I handle the event I don't receive OnItemClickListener calls anymore because I've consumed the touch event, and if I return false I don't receive callback when user stops touching the view. listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick

How to get random number on Android Object Animator

主宰稳场 提交于 2019-12-24 12:13:52
问题 Hello guys i am trying to get random number in my object animator. I want to get random number for "TranslationX" ` imagebutton1.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { counter++; final TextView score = (TextView)findViewById(R.id.textView1); score.setText("Score:"+counter); ObjectAnimator anim = ObjectAnimator.ofFloat(imagebutton1, "translationX", 100f, 100f); anim.setDuration(3600); anim.start();; anim.setInterpolator(new AccelerateDecelerateInterpolator(

objectAnimator shows white background for fragments in Android

こ雲淡風輕ζ 提交于 2019-12-24 12:07:54
问题 i am trying to implement slide in slide out animation for fragments. animation is working fine but it shows some white color layout in between how can i hide or remove that? i referred to this post, but don't know exactly what has to be done Android - Making translations and objectAnimator on the same XML file my slide-in-left.xml <set xmlns:android="http://schemas.android.com/apk/res/android" > <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500"

How to stop animation from repeating - Layout animation

跟風遠走 提交于 2019-12-24 08:39:06
问题 I'm trying to animate(fade out+pop-in) a couple of text views inside a relative layout on a button click. But after all the text views are done animating, the animation is repeating again. Can someone help me to stop it from repeating. Below is my code. Also please let me know if any other resources are required. Activity.kt (Inside onCreate method) createTextViews() // dynamic creation of textviews animateView(relLayout,R.anim.pop_in_fadein,1) // // some other code // btnCancel1

Animating the Application Icon or Logo in the actionbar

做~自己de王妃 提交于 2019-12-24 08:20:21
问题 Is it possible to animate(rotate) the application icon in the actionbar. Not the menuItems but the application icon on the left side of the screen. I have a circular logo for my app and I need to make it more dynamic by rotating it slowly and indefinitely as long as the app is running. Thanks in Advance... Happy Coding 回答1: Action bar accepts Drawable for an icon, hence you can use AnimationDrawable and define your animation frames in resources. Look through Drawable Animation android docs to

Chain animatorSet android animation

狂风中的少年 提交于 2019-12-24 07:05:37
问题 New to android i would like to make some smooth animation. I have a file on device that contains effects and each effect is an animation. The file tells me when an effect will be played and the effect duration. The problem is i cannot chain animatorSet dynmacily : AnimatorSet mainAnimatorSet(); _listAllAnimator // Will contain every AnimatorSet(); for (int i = 0; i < listEffects; i++) { // Build animatorSet ObjectAnimaTor1... ObjectAnimaTor2... AnimatorSet animatorSet = new AnimatorSet();

How Do I Set My View LayoutParams Width Smaller?

拜拜、爱过 提交于 2019-12-24 06:47:46
问题 Hi I am borrowing Seth's method found here to animate my viewGroups. It works great but in the wrong direction - This is my first time using/extending the Animation class and I cant figure how to decrease the size of my view -This expands it. Below is the class and how I use it. Any help will be greatly appreciated. public class ContainerAnim extends Animation { int targetWidth; View view; boolean opened; public ContainerAnim(View v, int targetWidth, boolean opened) { this.view = v; this

Android animate TextView from middle of page to the top

元气小坏坏 提交于 2019-12-24 03:37:12
问题 I have a TextView in the middle of my page in an XML file. I'd like to move this in an animate way to the top of it's container when I click on it. What's the best way to do this? Thanks. 回答1: Define a translate animation and put it in your res/anim folder. This one moves the view up by 175 dp, adjust android:toYDelta accordingly for your purposes. my_anim.xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android