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"/>