0
提及的波紋管是我正在爲long click listener事件註冊framelayout的代碼。framelayout上的setOnLongClickListener無法按預期方式工作
private void createActivityLayout(Fragment fragment)
{
FrameLayout frameLayout = (FrameLayout)getLayoutInflater().inflate(R.layout.professional_pa_frame_layout, null, false);
frameLayout.setClickable(true);
frameLayout.setOnLongClickListener(new View.OnLongClickListener()
{
public boolean onLongClick(View view)
{
if (actionMode == null)
{
return false;
}
actionMode = view.startActionMode(actionModelCallback);
view.setSelected(true);
return false;
}
});
getFragmentManager().beginTransaction().add(id, fragment, tag).commit();
}
該片段內部包含一系列edittext實例或單個imageview實例。
無論何時在framelayout上執行長按操作,我都會顯示edittext的上下文操作欄。我認爲事件被editext捕獲,並顯示不同的上下文操作欄。每當我在framelayout中獲得長按事件時,都會顯示上下文操作欄的PFA圖像。
我如何能捕捉長按事件對我的FrameLayout作爲一個整體而不考慮其內部的意見顯示上下文操作欄。下面寫的xml代碼是我想爲我的framelayout顯示的上下文操作欄。
<item android:id="@+id/action_discard_notes"
android:icon="@drawable/discard_note"
android:title="@string/action_discard_notes"
android:showAsAction="always"
android:orderInCategory="1"/>