Java 文本视图中的ontouchlisteners
我试图在我拥有的每一个文本视图中实现一个ontouchlistener,这样当我触摸文本视图时,它就会产生振动 但是,我有一个问题“无法降低view.ontouchlistener中继承方法的可见性” 有人知道我做错了什么吗?我已经实现了OnTouchListenerJava 文本视图中的ontouchlisteners,java,android,Java,Android,我试图在我拥有的每一个文本视图中实现一个ontouchlistener,这样当我触摸文本视图时,它就会产生振动 但是,我有一个问题“无法降低view.ontouchlistener中继承方法的可见性” 有人知道我做错了什么吗?我已经实现了OnTouchListener for (int i = 0; i < counter; i++) { tv[i] = new TextView(this);
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;
}
for(int i=0;i
只需将此onTouch()方法公开即可
public boolean onTouch(View v, MotionEvent event)
{
vibratePattern();
return true;
}