Android 弹出popupWindow中嵌套viewPager和PagerSlidingTabStrip出现的错误
摘要:先上错误信息我的代码是个自定义的popupWindowpublicMyPopupWindow(DataQueryActivitydataQu...
先上错误信息
我的代码
是个自定义的popupWindow
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);
} initView方法
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);
} 谢谢大佬的帮助
回复讨论(解决方案)
你这个viewpager的适配器有没有添加fragment的集合啊? 加入了fragment集合,我最后没用用弹出window,又开启了一个Activity就没有这问题了
【Android 弹出popupWindow中嵌套viewPager和PagerSlidingTabStrip出现的错误】相关文章:
★ 浅谈Android Content Provider的使用
★ android ListView和GridView拖拽移位实现代码
★ Android SlidingDrawer 抽屉效果的实现
★ android PopupWindow 和 Activity弹出窗口实现方式
★ 浅谈Android onTouchEvent 与 onInterceptTouchEvent的区别详解
★ Android中BroadcastReceiver(异步接收广播Intent)的使用
上一篇:
安卓Socket编程,接收数据的疑问