使用PopWindow时,设置了
- Width:200dp
- Height:Match_parent
然而显示出来的时候确实这酱紫的:
阿西吧,左侧和下侧居然有间隙,而且还有一个难看的背景色,跟设计图完全对不上啊,于是乎,一同找:
最最后,发现是由于继承父类PopWindow的原因,然后便使用了父类的一系列属性
public DevicePopWindow(Context context) {
super(context);//都是super惹的祸
View v = LayoutInflater.from(context).inflate(R.layout.left_menu, null);
RelativeLayout rl_colse = (RelativeLayout) v.findViewById(R.id.rl_colse);
rl_colse.setAlpha(1f);
recycler_left_menu = (RecyclerView) v.findViewById(R.id.recycler_left_menu);
deviceAdapter = new DeviceAdapter(context);
recycler_left_menu.setLayoutManager(new LinearLayoutManager(context));
recycler_left_menu.setAdapter(deviceAdapter);
recycler_left_menu.addItemDecoration(new DividerGridItemDecoration(context,0));
left_menu_close = (ImageView) v.findViewById(R.id.left_menu_close);
setListeners();
setWidth(Utils.dip2px(context, 260));
setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
setContentView(v);
}
删掉 super(context)即可