2017-08-29 8 views
0

RecyclerViewにクリックすると、ButtonをクリックしてViewHolderに表示されるようになりました。RecyclerViewにビューを追加

enter image description here

ViewHolder3Buttonをクリックして、ビュー(ビューはさらに追加)を追加し、上記の画像のように表示されます。

ViewAddMoreピンがそこにあり、RecyclerViewは正常にスクロールできます。

私は試みましたが、私の問題の解決策は見つかりませんでした。 問題がありますか?

+0

だから、どこのViewAddMoreを見たいですか? – Raghavendra

+0

@Raghavendra:それは動的です。ユーザーが 'Button'をクリックすると、' ViewHolder1'と 'ViewHolder2'の上にViewAddMoreが現れます。 –

+0

私はこれをしないことをお勧めします。 1つのポップアップボックスでrecyclerViewsビューをブロックするのは本当に悪いデザインです。 –

答えて

0

このビューを表示するには、PopupWindowを使用してください。

// get a reference to the already created main layout 
    LinearLayout mainLayout = (LinearLayout) findViewById(R.id.activity_main_layout); 

    // inflate the layout of the popup window 
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); 
    View popupView = inflater.inflate(R.layout.popup_window, null); 

    // create the popup window 
    int width = LinearLayout.LayoutParams.WRAP_CONTENT; 
    int height = LinearLayout.LayoutParams.WRAP_CONTENT; 
    boolean focusable = true; // lets taps outside the popup also dismiss it 
    final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable); 

    // show the popup window 
    popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0); 

    // dismiss the popup window when touched 
    popupView.setOnTouchListener(new View.OnTouchListener() { 
     @Override 
     public boolean onTouch(View v, MotionEvent event) { 
      popupWindow.dismiss(); 
      return true; 
     } 
    }); 
  1. https://developer.android.com/reference/android/widget/PopupWindow.html

  2. How to make a simple android popup window?

これはあなたを助けることを願っています。

関連する問題