制作菜单栏时出现ExpandableListView问题(与facebook类似)

制作菜单栏时出现ExpandableListView问题(与facebook类似),listview,expandable,Listview,Expandable,//////////////////////////////// 嗨,我在制作菜单栏时遇到了一个问题 它的工作原理类似于Facebook菜单栏- (当我按下按钮时,出现包含可展开列表视图和主布局移动的菜单。) 到页面的右侧) 问题是,当我单击listview展开父行(以查看子行)时 菜单消失,主布局回到主侧 我试图弄明白,当我使用expandGroup()方法强制展开父行时 这种情况再次发生 我想解决它,但我自己解决不了。请帮帮我(请原谅我的英语不好) ->我用AnimationListener

//////////////////////////////// 嗨,我在制作菜单栏时遇到了一个问题

它的工作原理类似于Facebook菜单栏-

(当我按下按钮时,出现包含可展开列表视图和主布局移动的菜单。) 到页面的右侧)

问题是,当我单击listview展开父行(以查看子行)时

菜单消失,主布局回到主侧

我试图弄明白,当我使用expandGroup()方法强制展开父行时

这种情况再次发生

我想解决它,但我自己解决不了。请帮帮我(请原谅我的英语不好)

->我用AnimationListener做的

// class that defines events on clicking menu button
class NaviClickListener implements OnClickListener {
    @Override
    public void onClick(View v) {
        MainFrame me = MainFrame.this;
        Context context = me;
        Animation anim;


        if(isMenuOpened){
            Log.d("On NAVICLICKLISTENER CALLED", "true");
        }else{
            Log.d("On NAVICLICKLISTENER CALLED", "false");
        }

        int w = parentLinearLayout.getMeasuredWidth();
        int h = parentLinearLayout.getMeasuredHeight();
        int left = (int) (parentLinearLayout.getMeasuredWidth() * 0.55);

        if (!isMenuOpened) {
            // anim = AnimationUtils.loadAnimation(context, R.anim.push_right_out_80);
            anim = new TranslateAnimation(0, left, 0, 0);
            mainNaviLayout.setVisibility(View.VISIBLE);
            animParams.init(left, 0, left + w, h);


        } else {
            // anim = AnimationUtils.loadAnimation(context, R.anim.push_left_in_80);
            anim = new TranslateAnimation(0, -left, 0, 0);
            animParams.init(0, 0, w, h);
        }
        anim.setDuration(400);
        anim.setAnimationListener(me);
        //Tell the animation to stay as it ended (we are going to set the app.layout 
     first than remove this property)
        anim.setFillAfter(false);


        // Only use fillEnabled and fillAfter if we don't call layout ourselves.
        // We need to do the layout ourselves and not use fillEnabled and fillAfter 
  because when the anim is finished
        // although the View appears to have moved, it is actually just a drawing effect and the View hasn't moved.
        // Therefore clicking on the screen where the button appears does not work, but clicking where the View *was* does
        // work.
        // anim.setFillEnabled(true);
        // anim.setFillAfter(true);

        parentLinearLayout.startAnimation(anim);
    }
    }
  ///////////////

//about animation methods
 void layoutApp(boolean menuOut) {
        parentLinearLayout.layout(animParams.left, animParams.top,     
    animParams.right, animParams.bottom);
        //Now that we've set the app.layout property we can clear the animation, 
   flicker avoided :)
        parentLinearLayout.clearAnimation();

  }
@Override
public void onAnimationEnd(Animation animation) {
    // TODO Auto-generated method stub
    Log.d("On ANIMATIONEND CALLED", "ASDFASDFASDF");
    isMenuOpened = !isMenuOpened;
    if (!isMenuOpened) {
        mainNaviLayout.setVisibility(View.INVISIBLE);
    }
    layoutApp(isMenuOpened);
}
@Override
public void onAnimationRepeat(Animation animation) {
    Log.d("On ANIMATION repeat CALLED", "ASDFASDFASDF");
    // TODO Auto-generated method stub

}
@Override
public void onAnimationStart(Animation animation) {
    // TODO Auto-generated method stub

    Log.d("On ANIMATION start CALLED", "ASDFASDFASDF");
}
static class AnimParams {
    int left, right, top, bottom;

    void init(int left, int top, int right, int bottom) {
        this.left = left;
        this.top = top;
        this.right = right;
        this.bottom = bottom;
      }
  }