页面卷曲由于harism,文本在两页模式下显示不正常

时间:2014-03-02 12:29:33

标签: android page-curl

我正在使用Harism https://github.com/harism/android_page_curl的页面卷曲动画。我正在通过绘制文本而不是图像来测试这个项目。当它是单页模式时,它显示正常文本:enter image description here

但是当它是两页模式(横向)时,结果如下所示: enter image description here

问题是左侧的文本状态。有一种方法 onSizeChanged 可控制屏幕方向并更改页面模式:

 @Override
    public void onSizeChanged(int w, int h) {
            if (w > h) { 
                mCurlView.setViewMode(CurlView.SHOW_TWO_PAGES);
               mCurlView.setMargins(.1f, .05f, .1f, .05f);
            } else { 
                mCurlView.setViewMode(CurlView.SHOW_ONE_PAGE);
                mCurlView.setMargins(.1f, .1f, .1f, .1f);
    }
    }

更改模式后,页面将更新

private void updatePageRects() {
      if (mViewRect.width() == 0 || mViewRect.height() == 0) {
          return;
      } else if (mViewMode == SHOW_ONE_PAGE) {
          mPageRectRight.set(mViewRect);
          mPageRectRight.left += mViewRect.width() * mMargins.left;
          mPageRectRight.right -= mViewRect.width() * mMargins.right;
          mPageRectRight.top += mViewRect.height() * mMargins.top;
          mPageRectRight.bottom -= mViewRect.height() * mMargins.bottom;

          mPageRectLeft.set(mPageRectRight);
          mPageRectLeft.offset(-mPageRectRight.width(), 0);

          int bitmapW = (int) ((mPageRectRight.width() * mViewportWidth) / mViewRect
                  .width());
          int bitmapH = (int) ((mPageRectRight.height() * mViewportHeight) / mViewRect
                  .height());
          mObserver.onPageSizeChanged(bitmapW, bitmapH);
      } else if (mViewMode == SHOW_TWO_PAGES) {
          mPageRectRight.set(mViewRect);
          mPageRectRight.left += mViewRect.width() * mMargins.left;
          mPageRectRight.right -= mViewRect.width() * mMargins.right;
          mPageRectRight.top += mViewRect.height() * mMargins.top;
          mPageRectRight.bottom -= mViewRect.height() * mMargins.bottom;

          mPageRectLeft.set(mPageRectRight);
          mPageRectLeft.right = (mPageRectLeft.right + mPageRectLeft.left) / 2;
          mPageRectRight.left = mPageRectLeft.right;

          int bitmapW = (int) ((mPageRectRight.width() * mViewportWidth) / mViewRect
                  .width());
          int bitmapH = (int) ((mPageRectRight.height() * mViewportHeight) / mViewRect
                  .height());
          mObserver.onPageSizeChanged(bitmapW, bitmapH);
      }
  }

使用OpenGL / ES创建此项目。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

这似乎是图书馆中的另一个错误。根据GitHub的评论,最近更新了关于两页功能的代码。我建议联系作者并要求修复。