1

我正在开发一个使用 a 的 Android 应用程序framelayout,其中有两个视图膨胀:

  • 上视图包含应用程序的主要功能;
  • 下视图包含一个使用“下拉刷新”功能实现的可刷新列表。

上视图向右移动,以便您可以看到包含列表的下视图,但是当我开始执行下拉刷新操作时,上视图会返回到左侧,覆盖包含列表的下视图。列表会刷新,但我不希望上部视图以这种方式运行,覆盖下部视图。
我想知道是否有办法冻结上视图,直到用户执行其他操作(单击按钮)将其返回到下视图。

    LayoutInflater inflater = LayoutInflater.from(this);
    final FrameLayout main = new FrameLayout(this);

    menu = inflater.inflate(R.layout.offerlist, null);
    app = inflater.inflate(R.layout.main, null);

    main.addView(menu);
    main.addView(app);
    setContentView(main);

    Display display = (Display) ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
            .getDefaultDisplay();
    final int width = display.getWidth();
    final float wDip = TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, 70, this.getResources()
                    .getDisplayMetrics());
            ...

            app.startAnimation(hide);
            menuw = (int) (width - wDip);
    app.offsetLeftAndRight(-menuw);

先感谢您。

4

0 回答 0