2012-06-22 10 views
0
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); 
      View layout = inflater.inflate(R.layout.shopping_list_layout, null); 

      Button cancel_btn = (Button) layout.findViewById(R.id.cancel_btn); 
      Button clear_list_btn = (Button) layout.findViewById(R.id.clear_list); 
      Button remind_me_btn = (Button) layout.findViewById(R.id.calender_btn); 
      Button sent_mail_btn = (Button) layout.findViewById(R.id.mail_btn); 
      Button all_addto_cart_btn = (Button) layout 
        .findViewById(R.id.add_to_cart); 

      TextView oderable_no_of_products = (TextView) layout 
        .findViewById(R.id.orderable_product_no); 
      TextView oderable_products_price = (TextView) layout 
        .findViewById(R.id.oderable_product_price); 

      final TextView no_of_product = (TextView) layout 
        .findViewById(R.id.no_of_product_inshopping_list); 
      final TextView total_price_in_shopinglist = (TextView) layout 
        .findViewById(R.id.total_sum); 

      final ListView shopping_listview = (ListView) layout 
        .findViewById(R.id.shopping_listview); 

      final PopupWindow pw = new PopupWindow(layout, 1105, 717, true); 
      pw.showAtLocation(layout, Gravity.CENTER, 0, 0); 

      LoadProductsForShoppingList shopping_list_obj = new LoadProductsForShoppingList(
        DynamicTableActivity.this, pw, ac.getImageloder(), 
        shopping_listview, no_of_product, total_price_in_shopinglist, 
        oderable_no_of_products, oderable_products_price); 
      shopping_list_obj.execute(Constant.shopping_list_query); 

      cancel_btn.setOnClickListener(new View.OnClickListener() { 

       @Override 
       public void onClick(View v) { 
        // TODO Auto-generated method stub 
        pw.dismiss(); 
       } 

      }); 

      all_addto_cart_btn.setOnClickListener(new View.OnClickListener() { 

       @Override 
       public void onClick(View v) { 
        // TODO Auto-generated method stub 

        // add all products list to cart 
        addAllProductsToCartFromShoppingList(); 
       } 

      }); 

      clear_list_btn.setOnClickListener(new View.OnClickListener() { 

       @Override 
       public void onClick(View v) { 
        // TODO Auto-generated method stub 

        // clear shopping list 
        clearShoopingList(shopping_listview, no_of_product, 
          total_price_in_shopinglist); 
       } 

      }); 

`如何打開列表項上下文菜單中單擊如果列表視圖在彈出的窗口中打開。如何打開上下文菜單列表項的點擊,如果在彈出的窗口中打開列表視圖

回答

1

可以使用

shopping_listview.setOnItemLongClickListener(new OnItemLongClickListener() { 

      @Override 
      public boolean onItemLongClick(AdapterView<?> parent, View view, 
        int position, long id) { 

上長按顯示與列表的對話框.....

+0

,但我有在單細胞的一些項目也通過列表視圖檢測...? ? –

+0

「在單行中的數字項目」沒有得到 –

+0

我使用按鈕,圖像視圖textview在單個單元格的列表視圖,所以需要註冊關聯視圖的上下文菜單regiterforcontextmenu(任何視圖)。 –

相關問題