2017-09-22 3 views
0

J'ai créé TapTargetView (ou TapTargetSequence) dans toutes mes activités et il affiche bien, mais pour les vues internes du menu contextuel, il se cache derrière ma fenêtre de menu contextuel! exactement entre sous activité et menu contextuel. comment puis-je l'amener au sommet, s'il vous plaît? Le paramètre du paramètre TapTargetSequence ((Activity)) est-il correct? "contexte" ou "ceci" se produit erreur!TapTargetView est placé derrière le menu contextuel

public class Popup_Menu implements OnClickListener { 

PopupWindow popup;  View layout;  Context context; 
WindowManager wm; 

    void showPopup(final Activity context) { 
     this.context=context; 
         // Inflate the popup_layout.xml 
    LinearLayout viewGroup = (LinearLayout) ((Activity) context).findViewById(R.id.popup); 
    LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    layout = layoutInflater.inflate(R.layout.popup_layout_menu, viewGroup); 

         // Creating the PopupWindow 
     popup = new PopupWindow(context); 
     popup.setContentView(layout); 
         // Clear the default translucent background 
     popup.setBackgroundDrawable(new BitmapDrawable()); 
     popup.showAtLocation(layout, Gravity.BOTTOM, 30 ,0); 

    tapTarget_menu(); 

    }  /////////////////// close of showPopup() ! 








    // TapTaget_menu 
public void tapTarget_menu() { 
    new TapTargetSequence((Activity) context) 
      .targets(
        TapTarget.forView(layout.findViewById(R.id.chkb_menu_remem), "remember", "last lesson") 
// first target 
          .targetCircleColor(R.color.sabz_seyedi) 
          .outerCircleColor(R.color.sabzabi_kmrng) 
          .dimColor(R.color.sabz_seyedi) 
          .titleTextSize(22) 
          .descriptionTextSize(16) 
          .textColor(R.color.white) 
          .drawShadow(true) 
          .transparentTarget(true) 
          .cancelable(false) 
          .targetRadius(60), 
// second target 
        TapTarget.forView(layout.findViewById(R.id.ll_call_menu), "call", "connecting friends!") 
          .targetCircleColor(R.color.sabz_seyedi) 
          .outerCircleColor(R.color.sabzabi_tireh) 
          .dimColor(R.color.sabz_seyedi) 
          .titleTextSize(22) 
          .descriptionTextSize(16) 
          .textColor(R.color.white) 
          .drawShadow(true) 
          .transparentTarget(true) 
          .cancelable(false) 
          .targetRadius(60) 
      ).start(); 
} 

} 

Répondre

0

J'ai trouvé ma solution! J'ai changé ce code après popup.showAtLocation(), comme suit et il peut afficher tapTargetView en haut de PopupWindow. VIVA MOI !!!

WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); 
    layoutParams.packageName = context.getPackageName(); 
    layoutParams.format = PixelFormat.TRANSLUCENT; 
    layoutParams.flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; 

puis, par la méthode showPopup():

public void tapTarget_menu1(){ 
    TapTarget target = TapTarget.forView(layout.findViewById(R.id.ll_call_menu), "remember", "last lesson"); 
           .targetCircleColor(R.color.sabz_seyedi) 
           .outerCircleColor(R.color.sabzabi_tireh) 
           .titleTextSize(24) 
           .descriptionTextSize(18) 
           .textColor(R.color.black) 
           .drawShadow(true) 
           .cancelable(false) 
           .transparentTarget(true) 
           .targetRadius(60); 

    content = (ViewGroup) layout.findViewById(android.R.id.content); 
    final TapTargetView tapTarget_menu1 = new TapTargetView(context, wm, content, target, new TapTargetView.Listener(){ 
     @Override 
     public void onTargetClick(TapTargetView view) { 
      tapTarget_menu2(); 
      super.onTargetClick(view); 
     } 
    }); 
    ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).addView(tapTarget_menu1, layoutParams); 
}