如何获取视图参考行号,以了解用户在Android中单击TextViews的位置

如何获取视图参考行号,以了解用户在Android中单击TextViews的位置,android,textview,Android,Textview,`公共无效参考账单(布尔值全部) { int rowTemp=0 if (all == false ) rowTemp = rowIndex ; for (int row = rowTemp ; row <= rowIndex ; row++) { for (int i = 0; i < MAX; i++) { TextView editText = new TextView(this);

`公共无效参考账单(布尔值全部) { int rowTemp=0

   if (all == false )
       rowTemp = rowIndex ;


   for (int row  = rowTemp ; row <= rowIndex  ; row++)
   {
       for (int i = 0; i < MAX; i++)
       {
           TextView editText = new TextView(this);
           GridLayout.LayoutParams param = new GridLayout.LayoutParams();
           param.height = GridLayout.LayoutParams.WRAP_CONTENT;//ViewGroup.LayoutParams.WRAP_CONTENT;

           // String id_text = String.valueOf(rowIndex) + String.valueOf(i) ;
           // int id_int = Integer.valueOf(id_text);
           // editText.set

           if (i == 2)
               param.width = 70;    // Qualnity GridLayout.LayoutParams.MATCH_PARENT;
           else if (i == 3)
               param.width = 100;   //Rate//-25
           else if (i == 4)
               param.width = 80;   //Discount-20
           else if (i == 5)
               param.width = 140;   // Amount-20
           else if (i == 6)
               param.width = 40;    // %
           else if (i == 7)
               param.width = 75;  // cTax
           else if (i == 8)
               param.width = 75;  // sTax
           else if (i == 9)
               param.width = 180;  // Ttoal amount
           else
               param.width = 45 + (i * 250);

           param.rowSpec = GridLayout.spec(1 + row);
           param.columnSpec = GridLayout.spec(i);
           param.setMargins((5), 5, 0, 0);
           ///////editText.setTextColor(R.color.colorPrimaryDark);
           editText.setTextSize(12);
           editText.setTextColor(Color.BLACK);
           editText.setBackgroundColor(0xFFFFFFFF);
           editText.setLayoutParams(param);
           /////// editText.setId(Integer.parseInt("i"));
           editText.setText(BillArray[row][i]);
           Glyout.addView(editText);
       }
   }
   showBillTotal();
if(all==false)
rowTemp=rowIndex;

对于(int row=rowTemp;row我认为对于这样的任务,只需使用ListView而不是TextView