2011-02-25 54 views
1

我想實現在每一個ontouchlistener和每一個TextView的,我有這樣,當我觸摸textviews它會做的振動ontouchlisteners在textviews

但是我有這個問題「不能減少繼承方法的可見性from view.ontouchlistener「

任何人有任何想法我做錯了什麼?我已經實現了OnTouchListener已經

 for (int i = 0; i < counter; i++) 
     { 
       tv[i] = new TextView(this); 
       tv[i].setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
       tv[i].setTextSize(textSize); 
       tv[i].setText(""+singleText[i]); 
       tv[i].setOnTouchListener(this); 
       linearLayout.addView(tv[i]); 
     } 
     setContentView(linearLayout); 

    } 
    catch (IOException e) { 
     //You'll need to add proper error handling here 
    }  
} 

private boolean onTouch(View v, MotionEvent event) 
{ 
    vibratePattern(); 
    return true; 
} 

回答

2

只是使這種onTouch()方法public

public boolean onTouch(View v, MotionEvent event) 
{ 
    vibratePattern(); 
    return true; 
} 
+0

感謝這個作品 – ben 2011-02-25 08:10:58