2017-09-22 9 views
0

私はすべてのアクティビティでTapTargetView(またはTapTargetSequence)を作成して表示しましたが、ポップアップメニューの内部ビューではポップアップメニューウィンドウの後ろに隠れています。アクティビティとポップアップメニューの間に正確に表示されます。どのように私はそれをトップに持っていくことができますか? TapTargetSequence((Activity)コンテキスト)のパラメータは正しいですか? 「コンテキスト」または「this」はエラーが発生します。TapTargetViewはポップアップメニューの背後に配置されています

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(); 
} 

} 

答えて

0

私の解決策が見つかりました! popup.showAtLocation()の後に次のようにこのコードを変更し、PopupWindowの上にtapTargetViewを表示することができます。 VIVA ME !!!

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; 

次いで、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); 
} 
関連する問題