最後に、私はこの問題の解決策を見つけた:
私は返すように「真」longClickListenerでを必要としていました。 のような:
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
Log.d("debug", "onLongClick = " + i + " " + view.getTag());
return true;
}
});
そしてitem_view.xmlに次の行を追加する必要:
superParentレイアウトの行を追加します。そのImageViewのため
android:descendantFocusability="blocksDescendants"
を:
android:longClickable="true"
例:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="150dp"
android:descendantFocusability="blocksDescendants"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/text_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:longClickable="true"
android:background="#ff0000" />
</LinearLayout>
アダプタの 'imageView'に' onLongClick'イベントを入れてみてください。 –
imageViewのlongClickにタスクを実行したくありません。 – NehaK
私は同じ問題がありました。私はクリック、長いクリック、タップ、同じレイアウトの別の子をダブルタップを処理するためにAndroidのジェスチャーリスナーライブラリを使用しました。 –