0
내가하고 있어요

에서 글고 위치를 얻는 방법. 아래는 제 코드입니다. TextView의 위치를 ​​가져올 수 있지만 EditText의 위치를 ​​가져 오는 중에 문제가 발생했습니다..I이 <code>ListView</code>에 <code>EditText</code>의 위치를 ​​얻기과 문제에 직면하고있다 <code>ListView</code>의 각 항목에 네 <code>EditText</code>을 사용했다 <code>EditText</code> 들어 오길를 가진 <code>ListView</code>에 목록보기

  lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { 
       @Override 
       public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { 


        myproductpercarton = (TextView) view.findViewById(R.id.txtorderamount); 
        final String ssss =(String) ((TextView) view.findViewById(R.id.txtorderamount)).getText();    
        mytotalprice = (TextView) view.findViewById(R.id.txtprice); 
        mm = (CheckBox) view.findViewById(R.id.mycheck); 
        mm.setFocusableInTouchMode(true); 
        mm.setFocusable(true); 
        mm2 = (CheckBox) view.findViewById(R.id.mynewcheck); 
        mm2.setFocusableInTouchMode(true); 
        mm2.setFocusable(true); 
        myorderprice = (EditText) view.findViewById(R.id.txtorderby); 
        myorderprice.setFocusableInTouchMode(true); 
        myorderprice.setFocusable(true); 
        mycartonno = (EditText) view.findViewById(R.id.txtordercarton); 
        mycartonno.setFocusableInTouchMode(true); 
        mycartonno.setFocusable(true); 


        myproductno = (EditText) view.findViewById(R.id.txtproduct); 
        myproductno.setFocusableInTouchMode(true); 
        myproductno.setFocusable(true); 

        myproductno.setOnClickListener(new View.OnClickListener() { 
         @Override 
         public void onClick(View v) { 


          String myprodpercart; 
          map = (HashMap<String, String>) getListView().getItemAtPosition(position); 
          HashMap<String, String> map2 = (HashMap<String, String>) getListView().getItemAtPosition(position); 
          HashMap<String, String> map3 = (HashMap<String, String>) getListView().getItemAtPosition(position); 


          double orderId4; 
          double mycarton2; 
          double mynewcart; 
          double myprodno2; 
          double mycartquantity; 
          double mytotal; 
          String mynoocarton; 
          double mynoocarton44; 
          int myprodno3;       
          String temp=mycartonno.getText().toString(); 
          String contents = mycartonno.getText().toString(); 
          orderId4 = new Double(map.get(TAG_PRODUCTPERCARTON)); 
          Log.d("MyOrderId :: ", String.valueOf(orderId4)); 
          mycartonprice2 = map.get(TAG_PRODUCTPERCARTON2); 
          Log.d("MyCartonPrice :: ", String.valueOf(mycartonprice2));        
          mynoocarton = mycartonno.getText().toString(); 
          mynoocarton44 = new Double(mycartonno.getText().toString()); 

          mycarton2 = new Double(mynoocarton); 
          mynewcart = new Double(mycartonprice2); 
          myprodno2 = new Double(orderId4 * mycarton2); 
          myprodno3 = new Integer((int) myprodno2); 
          mycartquantity = new Double(mycartonno.getText().toString()); 
          Log.d("MyCartonNo :: ", mycartonno.getText().toString()); 
          Log.d("MyCartonNo2 :: ",contents);        
          mytotal = new Double(mycartquantity * mynewcart); 
          String mynoocarton3 = String.valueOf(mynoocarton44);        
          String total = String.valueOf(mytotal); 
          String mm = String.valueOf(myprodno3);        
          mycartonno.setText(mynoocarton3); 
          myproductno.setText(mm); 
          mytotalprice.setText(total); 
          Toast.makeText(getActivity(), ssss + " " + mynewcart + "----" + mm + " " + total, 
            Toast.LENGTH_SHORT).show(); 

         } 
        }); 
        mydiscount = (EditText) view.findViewById(R.id.txtdiscount); 
        mydiscount.setFocusableInTouchMode(true); 
        mydiscount.setFocusable(true); 
       } 
      }); 
+0

문제는 무엇인가? 당신이 자리를 잡을 수없는 곳을 의미합니까? – Vickyexpert

+0

목록 항목 레이아웃의 코드 공유 – LaurentY

+0

어떤 "문제"가 있습니까? – jaibatrik

답변

0

저는이 문제를 혼자서 해결했으며 이제는 정상적으로 작동합니다. 방금 textviewedittext 두 개를 setOnClickListener 안에 넣었습니다. 방금 setOnClickListener 코드 아래에 추가했습니다.

TextView mynewtotal = (TextView) view.findViewById(R.id.txtprice); 
EditText mycartonprod = (EditText) view.findViewById(R.id.txtordercarton); 
mycartonprod.setFocusableInTouchMode(true); 
mycartonprod.setFocusable(true); 
EditText myprod = (EditText) view.findViewById(R.id.txtproduct); 
myprod.setFocusableInTouchMode(true); 
myprod.setFocusable(true);