Hello I just run into a similar problem, did you find a solution?
Regards
El jueves, 20 de enero de 2011 19:04:22 UTC+1, Aaron Buckner escribió:
>
> Ok so here is the deal... I have a menu at the bottom of my apps
> screen that works normally hits/clicks register fine.
>
> When you select the "hide menu" button which is an arrow image the
> animation works fine and the menu and the hide menu button move down
> as they should, here is where it gets weird, The "hit area" or "click
> area" whatever you want to call it remains where in the original
> location for both the menu and the "hide menu" button, If I click on
> the "hide menu" button again (where it was prior to the animation,
> nothing happens when I click on its current location) it returns to
> the visible position (which I defined through a state holder variable
> and a couple if statements) so the code seems to be functioning
> normally except that the button clickable areas aren't moving... can
> someone explain where I'm going wrong or what I need to do?
>
> Here is some of the code:
> [Snippet from Main Activity]
> //Nav Button
> ImageButton NavDrawerBtn = (ImageButton)
> findViewById(R.id.nav_drawer_btn);
> NavDrawerBtn.setOnClickListener(new View.OnClickListener() {
> public void onClick(View v) {
> //Toast.makeText(Dashboard.this, "Nav",
> Toast.LENGTH_SHORT).show();
> animateNavDrawerBtn();
> }
> });
>
> private void animateNavDrawerBtn(){
> ImageButton NavDrawerBtn = (ImageButton)
> findViewById(R.id.nav_drawer_btn);
> ...
> View NavDrawer = (View) findViewById(R.id.nav_drawer);
>
> //State 1 = Bottom
> //State 2 = Middle
> //State 3 = Top
> //If State is 1 move to 2 and set to 2
> if (navState == 1){
> NavDrawerBtn.startAnimation(new
> NavDrawerBtnAnimMid());
> NavDrawer.startAnimation(new NavDrawerAnimMid());
> navState = 2;
> return;
>
> //If State is 2 move to 1 and set to 1
> }
> if (navState == 2){
> NavDrawerBtn.startAnimation(new
> NavDrawerBtnAnimBottom());
> NavDrawer.startAnimation(new NavDrawerAnimBottom());
> navState = 1;
> return;
> }
> //If State is 3 move to 2 and set to 2
> if (navState == 3){
> NavDrawerBtn.startAnimation(new
> NavDrawerBtnAnimMid());
> navState = 2;
> return;
> }
>
> }
>
> [Snippet from NavDrawerBtnAnim***/NavDrawerAnim*** Classes (only line
> that is changes is the matrix.setTRamslate(xxx,xxx) line]
> import android.graphics.Matrix;
> import android.view.animation.Animation;
> import android.view.animation.LinearInterpolator;
> import android.view.animation.Transformation;
>
> public class NavDrawerAnimBottom extends Animation{
> public void NavAnimation2(){}
>
> @Override
> public void initialize(int width, int height, int parentWidth,
> int parentHeight){
>
> super.initialize(width,height,parentWidth,parentHeight);
> setDuration(2500);
> setFillAfter(true);
> setInterpolator(new LinearInterpolator());
> }
> @Override
> protected void applyTransformation(float interpolatedTime,
> Transformation t){
> final Matrix matrix = t.getMatrix();
> matrix.setTranslate(0, 125);
> }
> }
>
> This seems to be similar to what was described here:
>
> http://www.mail-archive.com/[email protected]/msg24588.html
> As Romain Guy suggested I tried adding the requestLayout(); param like
> this:
>
> [Modified Code Snippet]
> if (navState == 1){
> NavDrawerBtn.startAnimation(new
> NavDrawerBtnAnimMid());
> NavDrawer.startAnimation(new NavDrawerAnimMid());
> NavDrawerBtn.requestLayout();
> NavDrawer.requestLayout();
> navState = 2;
> return;
> }
> //If State is 2 move to 1 and set to 1
> if (navState == 2){
> NavDrawerBtn.startAnimation(new
> NavDrawerBtnAnimBottom());
> NavDrawer.startAnimation(new NavDrawerAnimBottom());
> NavDrawer.setEnabled(false);
> NavDrawerBtn.requestLayout();
> NavDrawer.requestLayout();
> navState = 1;
> return;
> }
>
> Which had no effect, any help would be greatly appreciated I'm lost
> here... Thanks
> Aaron Buckner
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en