Hi
This feels kind of embarrassing. Have I misunderstood the basics?
I want a Button to take care of Clicks, but to pass on LongClicks to
an enclosing View, in this case a TableRow.
I just can't get it work. I simplified the code down to what is shown
below without luck.
package my.namespace;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.Button;
import android.widget.TableLayout;
import android.widget.TableRow;
public class OnLongClickNotPassedOnToTableRowActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TableLayout t = new TableLayout(this);
TableRow r = new TableRow(this);
r.setLongClickable(true); // Doesn't help.
t.addView(r);
r.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true; // Never reached.
}
});
Button b = new Button(this);
r.addView(b);
/*
b.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return false; // Reached on long click if
uncommented
// but doesn't
help either.
}
});
*/
setContentView(t);
}
}
Jan
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en