我想实现一个类似于 Facebook 应用程序的滑动菜单栏,我使用以下github 示例来实现它。
我的所有应用程序屏幕中都有一个添加布局。我的问题如下:
- 我打开应用程序。
 - 我点击打开菜单的图标
 - 如果在我打开菜单期间加载应用程序,菜单会自动关闭。
 - 如果您单击打开菜单的图标,菜单就会跳动。
 - 仅当菜单打开时加载加载时才会发生这种情况。
 
这是我的典型布局文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Fill" >
<FrameLayout
    android:id="@+id/FL_home"
    style="@style/Fill"
    android:layout_above="@id/adView" >
    <include layout="@layout/app_com_menu" />
    <LinearLayout
        android:id="@+id/LL_app"
        style="@style/Fill.RL"
        android:orientation="vertical" >
        <include layout="@layout/app_com_title" />
        <ListView
            style="@style/FillWrap.List" />
        <include layout="@layout/network_error" />
    <include layout="@layout/error_no_live"/>
    </LinearLayout>
</FrameLayout>
<include layout="@layout/ad_layout" />
我的 ad_layout 文件如下:
<?xml version="1.0" encoding="utf-8"?>
<com.google.ads.AdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="xxxxxxxxxxxx"
ads:loadAdOnCreate="true"
android:visibility="gone" />
而这就是滑动抽屉的主要逻辑
class AppMenuListener implements OnClickListener {
    public void onClick(View v) {
        doAnimation();
    }
}
class AppMenuCloseListener implements OnClickListener {
    public void onClick(View v) {
        if (menuOut) {
            doAnimation();
        }
    }
}
private void doAnimation() {
    AppBase me = AppBase.this;
    Animation animation = null;
    int width = appPage.getMeasuredWidth();
    int height = appPage.getMeasuredHeight();
    int left = (int) (appPage.getMeasuredWidth() * 0.67);
    if (menuOut) {
        if (appMenu.getVisibility() == View.VISIBLE) {
            animation = new TranslateAnimation(0, -left, 0, 0);
            animation.setDuration(300);
            animParams.set(0, 0, width, height);
        }
    } else {
        if (appMenu.getVisibility() == View.INVISIBLE) {
            animation = new TranslateAnimation(0, left, 0, 0);
            appMenu.setVisibility(View.VISIBLE);
            animParams.set(left, 0, left + width, height);
            animation.setDuration(400);
        }
    }
    animation.setAnimationListener(me);
    animation.setFillEnabled(true);
    appPage.startAnimation(animation);
}
public void onAnimationEnd(Animation animation) {
    menuOut = !menuOut;
    if (!menuOut) {
        appMenu.setVisibility(View.INVISIBLE);
    }
    appPage.layout(animParams.left, animParams.top, animParams.right,
            animParams.bottom);
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
}
static class AnimParams {
    int left, right, top, bottom;
    void set(int left, int top, int right, int bottom) {
        this.left = left;
        this.top = top;
        this.right = right;
        this.bottom = bottom;
    }
}
我尝试使用 adListener 并在菜单出现时停止加载广告,但我没有太多运气。
有人可以建议我做什么不同的事情吗?