Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 63

QC
Aspiring developer
Profile
Posts: 50
Reg: Apr 20, 2013
Milwaukee, WI
6,650
02/17/14 03:54 PM (11 years ago)

Buttons - Table / grid layout trying to get the first button's image to fade - animation question - ANDROID

I am trying to put some animations on my buttons in BT using the Grid or Table layout. Wanted to fade the first button's image ultimately I want to fade in and out different buttons but trying to just get this working first. This is what I have below and the first image is not fading out. I can see by the debugging code that I put in, it is going through my code. //if we used a table layout... //add a few empty row at end so scrolling shows enough of bottom margin... if(usingTable){ BT_debugger.showIt(activityName + ":table10"); for(int t = 0; t < 3; t++){ TableRow tr = new TableRow(this); tr.setPadding(0, 0, 0, 0); RelativeLayout buttonBox = new RelativeLayout(this); buttonBox.setMinimumWidth(buttonSize); buttonBox.setMinimumHeight(buttonSize); tr.addView(buttonBox, buttonSize, buttonSize); tableLayout.addView(tr, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); int xcnt = 1; RelativeLayout box = (RelativeLayout) buttonBoxes.get(xcnt); AlphaAnimation alphaFade = new AlphaAnimation(0.3f, 1.0f); alphaFade.setDuration(500); alphaFade.setFillAfter(true); box.startAnimation(alphaFade); } BT_debugger.showIt(activityName + ":animationstat0"); // invalidate tableLayout... tableLayout.invalidate();
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/17/14 04:11 PM (11 years ago)
Instead, why not just use [UIView animateWithDuration:] ? Would look something like: UIButton *thisButton = [self.view viewWithTag:1]; [UIView animateWithDuration:.5 animations:^(void){ thisButton.alpha = .3f; }];
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/17/14 04:50 PM (11 years ago)
Ignore my post - I was thinking in iOS terms
 
QC
Aspiring developer
Profile
Posts: 50
Reg: Apr 20, 2013
Milwaukee, WI
6,650
like
02/18/14 02:47 PM (11 years ago)
my fault I forgot to put android in the subject
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.