80,337
社区成员
发帖
与我相关
我的任务
分享
public MyPopupWindow(DataQueryActivity dataQueryActivity, Context context, int width, int height){
mActivity = dataQueryActivity;
mContext = context;
mInflate = LayoutInflater.from(context).inflate(R.layout.view_popupwindow, null);
mDm = mContext.getResources().getDisplayMetrics();
initView();
setContentView(mInflate);
setBackgroundDrawable(new ColorDrawable(Color.WHITE));
setOutsideTouchable(true);
setWidth(width);
setHeight(height);
setFocusable(true);
setAnimationStyle(R.style.popuwindowAnimation);
showAtLocation(mInflate, Gravity.CENTER,width,0);
}
private void initView() {
mViewPager = (ViewPager) mInflate.findViewById(R.id.myviewpager);
mResuleAdapter = new ResultPagerAdapter(mActivity.getSupportFragmentManager(),tabs);
mPagerTabs = (PagerSlidingTabStrip) mInflate.findViewById(R.id.tabs);
//设置是否宽度铺满全屏
mPagerTabs.setShouldExpand(true);
//设置分割线的透明
mPagerTabs.setDividerColor(Color.TRANSPARENT);
//设置底部滚动条的高度
mPagerTabs.setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, mDm));
// 设置Tab Indicator的高度
mPagerTabs.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, mDm));
//设置滚动条的颜色
mPagerTabs.setIndicatorColor(mContext.getResources().getColor(android.R.color.white));
mViewPager.setAdapter(mResuleAdapter);
mPagerTabs.setViewPager(mViewPager);
}