[英]android viewpager in popupwindow
How can i place a swipeable ViewPager
with three tabs inside a PopupWindow
? 如何在
PopupWindow
内ViewPager
带有三个选项卡的可滑动式ViewPager
?
I'm totally curious about how to do that! 我对此完全好奇! The popup window is opened in a custom
View
. 弹出窗口在自定义
View
打开。
currently i have only the popupwindow, which works excellent: 目前我只有popupwindow,效果很好:
LayoutInflater li = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View popup_view = li.inflate(R.layout.popup_view, null);
final PopupWindow popup = new PopupWindow(context);
popup.setWidth(ViewGroup.LayoutParams.FILL_PARENT);
popup.setHeight(ViewGroup.LayoutParams.FILL_PARENT);
popup.setTouchable(true);
popup.setFocusable(true);
popup.setContentView(popup_view);
popup.showAtLocation(this, Gravity.NO_GRAVITY, 0, 0);
the popup_view.xml: popup_view.xml:
<?xml version="1.0" encoding="utf-8"?>
<!-- here i want to have the ViewPager with 3 tabs -->
so i have three more layouts ( tab_one.xml
tab_two.xml
and tab_three.xml
) in which are for now only some test text. 所以我还有另外三种布局(
tab_one.xml
tab_two.xml
和tab_three.xml
),目前仅其中一些测试文本。
You can implement this using fragments. 您可以使用片段来实现。 Create a FragmentActivity which calls a DialogFragment to display the popup window.
创建一个FragmentActivity,它调用DialogFragment来显示弹出窗口。 In it's view, you could define the ViewPager.
在它的视图中,您可以定义ViewPager。 Have a look at the following answer https://stackoverflow.com/a/19552298/3030934
看看下面的答案https://stackoverflow.com/a/19552298/3030934
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.