Frank-Zhu / PullZoomView

An Android custom ListView and ScrollView with pull to zoom-in.
Apache License 2.0
2.32k stars 623 forks source link

PullToZoomScrollView 嵌套 Viewpager #3

Closed 3349516 closed 10 years ago

3349516 commented 10 years ago

当 zoomView 为Viewpager的时候.Viewpager显示不全..Viewpager设置高度也无效

Frank-Zhu commented 10 years ago

@3349516 1、如果你是使用的PullToZoomScrollView,尝试一下以下设置,看是否可以解决问题。

        //设置viewPager的宽高参数,宽高比10:6
        int width = Utils.getScreenWidth(getActivity());
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) mScrollView.getHeaderContainer().getLayoutParams();
        layoutParams.width = width;
        layoutParams.height = (int) (width * 0.6);
        mScrollView.getHeaderContainer().setLayoutParams(layoutParams);

        FrameLayout.LayoutParams zoomParams = (FrameLayout.LayoutParams) mScrollView.getZoomContainer().getLayoutParams();
        zoomParams.width = width;
        zoomParams.height = (int) (width * 0.6);
        mScrollView.getZoomContainer().setLayoutParams(zoomParams);

2、如果你是使用的PullToZoomScrollViewEx,尝试调用一下setHeaderLayoutParams或者setHeaderViewSize方法设置Header的高度,具体用法可以参加DEMO实例。

        DisplayMetrics localDisplayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
        int mScreenHeight = localDisplayMetrics.heightPixels;
        int mScreenWidth = localDisplayMetrics.widthPixels;
        LinearLayout.LayoutParams localObject = new LinearLayout.LayoutParams(mScreenWidth, (int) (9.0F * (mScreenWidth / 16.0F)));
        scrollView.setHeaderLayoutParams(localObject);
3349516 commented 10 years ago

你更新了PullToZoomListViewEx 的demo ,,所以我改用了 PullToZoomListViewEx .能显示完全了..关于viewpager的回弹就没效果了...不过已经知道怎么做了..tks..

tanranran commented 9 years ago

PullToZoomScrollViewEx 如何监听滑动到底部呢?