Skip to content

您好,这个效果不错,但是有一个问题,就是标题如果在StickyNavLayout的外面,高度为50dp,然后listview最下面总是计算少了50dp #16

Open

Description

@hanguodong

您好,这个效果不错,但是有一个问题,就是标题如果在StickyNavLayout的外面,高度为50dp,然后listview最下面总是计算少了50dp

Activity

  1. LinF2015 commented on Aug 4, 2016

    @LinF2015

    我也遇到了这个问题,不知道你是怎么解决的?

  2. hxkdidi commented on Feb 14, 2017

    @hxkdidi

    给listView设置marginBottom= 50dp就可以了

  3. 823546371 commented on Aug 28, 2017

    @823546371

    原因找到了吗?

  4. hxkdidi commented on Aug 29, 2017

    @hxkdidi

    已经换了一个兼容性比较好的ScrollableLayout了

  5. xiayu98020214 commented on Oct 11, 2017

    @xiayu98020214

    我的解决方案:
    @OverRide
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
    //不限制顶部的高度
    Log.d(TAG, "onMeasure: ");
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    getChildAt(0).measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    ViewGroup.LayoutParams params = mViewPager.getLayoutParams();
    params.height = getMeasuredHeight() - mNav.getMeasuredHeight();
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);//要重新测量
    setMeasuredDimension(getMeasuredWidth(), mTop.getMeasuredHeight() + mNav.getMeasuredHeight() + mViewPager.getMeasuredHeight());
    }

  6. songzhw commented on Jan 24, 2018

    @songzhw

    我还试过让viewpager.height = UNSPECIFIED, 也没有成功.
    不过@xiayu98020214的两次super.onMeasure()确实有效.
    但原方案中的getChildAt(0)设置为UNSPECIFIED, 好像没有必要.

  7. HuJunYan commented on Sep 17, 2018

    @HuJunYan

    @xiayu98020214 用了一下你这个感觉可以,想问下 为啥要重新测量啊,不怎么懂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions