0

I am currently creating a popup window by this code:

View popupView = inflater.inflate(R.layout.popup, null);
final PopupWindow popupWindow = new PopupWindow(popupView, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
popupWindow.setAnimationStyle(R.style.Animation);
LinearLayout linearLayout = popupView.findViewById(R.id.linearLayout1);
linearLayout.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        popupWindow.dismiss();
        popu = false;
    }
});

ImageView imageView = popupView.findViewById(R.id.imageView1);
imageView.setImageResource(drawables[position]);
popupWindow.showAtLocation(imageView, Gravity.CENTER, 0, 0);
popu = true;

However, I want the popup to have multiple pages, like here:

picture

How can I implement a multi-paged popup into my app? can I add a ViewPager into my PopupWindow or I need to switch to a Dialog instead?

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
DAVIDBALAS1
  • 484
  • 10
  • 31
  • Its hard to manage the popup windows to have functions like these. Yes you should move to `DialogActivity` I think. – Reaz Murshed Jun 23 '17 at 21:53

1 Answers1

2
  1. Use DialogFragment instead. https://developer.android.com/reference/android/app/DialogFragment.html
  2. Inside of it you will need a ViewPager with your multiple pages
  3. Add page indicators to make it look similar You can use a library or TabLayout for the indicators: How do you create an Android View Pager with a dots indicator?
Leo DroidCoder
  • 14,527
  • 4
  • 62
  • 54