0

I have both a button and a textview with width="fill_parent". When the user clicks on the button, I need the button to squeeze to the right, a label to appear sliding out from below that button to the left (as if parting the sea). Using ObjectAnimator renders the correct size, but doesn't affect the text on the textview or button, leaving it no longer centered and with many leading spaces. The way it should be, but doesn't animate: [Picutre of Correct views, but without animation]

3/12/2016 Update:

This is my original post of this question, with all the applicable code: ObjectAnimator, Changing "ScaleX" or "Left," but text doesn't stay properly centered. I saw how verbose I was and realized many may not have the time; showing screenshots of my problem here seemed much more concise.

3/15/2016 Update: This is what I have animated correctly without the labels of the button and textview being animated correctly into their new bounds. Changed the textview's background red for easier visibility. https://www.dropbox.com/s/n14hed6xcknfh9b/SS_20160315_135938.mp4?dl=0

Community
  • 1
  • 1
Cypher16e
  • 1
  • 2
  • Can you post the code where you tell the view to animate? – Andrew No Mar 11 '16 at 21:36
  • @RuchirBaronia I've tried a number of things, including using ObjectAnimator on the elements' SetTextScaleX property. Either it scales the text to the original size, not the end size after animation, or it doesn't take effect unless the button is pressed more than once. I have been pulling my hair out over this seemingly minor problem (I must be doing something stupidly wrong) for over a week now, coming back when I've thought of something. All searching on this issue yields results that don't pertain, unfortunately. I appreciate any insight you're able to provide! – Cypher16e Mar 12 '16 at 18:00
  • @AndrewNo: Post updated with link to code. I honestly appreciate any insight you two (and others) may have! – Cypher16e Mar 12 '16 at 18:02
  • @Cypher16e, I may not wholly understand your problem. Are you trying to have the text slide over, on the button, and beside the button? Can you provide a photoshopped/faked picture of where you want things to start, and where you want things to finish? – Andrew No Mar 13 '16 at 04:49
  • @AndrewNo, Updated post with video of animation. The labels of the textview & button don't move along the x axis to continue to be centered within their new bounds. (They move upward to show a list below them, but only needed if user clicks the button.) – Cypher16e Mar 15 '16 at 21:57
  • @Cypher16e I see what you're trying to do. Unfortunately, It seems like you need to modify the layout params in the animation. I have never tried to do this, so I can not offer advice. I would however recommend you see if you can find a way to set the layout params to be the target of an animation, or something like that. – Andrew No Mar 17 '16 at 23:09
  • @AndrewNo I've been very busy lately, but what little time I've had and given your assistance, it seems ValueAnimator may be the answer I'm looking for. Something similar to http://stackoverflow.com/questions/7902976/objectanimator-animate-linearlayout-width may turn fruitful. I appreciate your thoughts & I'll eventually post my answer, once found. Thank you so much. – Cypher16e Mar 23 '16 at 09:52

0 Answers0