Tears_fg

导航

问题记录(PopWindow/Recyclerview)

一、问题:

PopWindow在7.0以上showAsDropDown()方法失效

解决方法:

 if (Build.VERSION.SDK_INT >= 24) {
            int tempheight = mBrandPop.getHeight();
            int screenHeight = anchor.getResources().getDisplayMetrics().heightPixels;
            if (tempheight == WindowManager.LayoutParams.MATCH_PARENT || screenHeight <= tempheight) {
                mBrandPop.setHeight(screenHeight - location[1] - anchor.getHeight());
            }
            mBrandPop.showAtLocation(anchor, Gravity.NO_GRAVITY, location[0], location[1] + anchor.getHeight());
        }else{
            mBrandPop.showAsDropDown(anchor);
        }

链接:

https://www.jianshu.com/p/dbd792b910ce

 

二、问题:

recylerview添加滑动布局后滑动冲突。

解决方法:

recylerview布局中添加这一属性:

 android:nestedScrollingEnabled="false"

 或者重写LinearLayoutManager的onScroll()方法,返回false,让item禁止滑动事件。

 

三、问题:

recylerview添加头布局后添加数据,子布局不显示/显示不全。

解决方法:

重新设置recylerview的高度。

    //解决recylerview item不显示问题
      ViewGroup.LayoutParams layoutParams = mRecyclerView.getLayoutParams();
      layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
      mRecyclerView.setLayoutParams(layoutParams);

 

posted on 2019-11-02 11:21  Tears_fg  阅读(714)  评论(0)    收藏  举报