的PopupMenu不recycleview正常工作

holder.iv_delete.setOnClickListener(new View.OnClickListener() { 

@Override

public void onClick(View v) {

final PopupMenu popupMenu = new PopupMenu(context, holder.iv_delete);

MenuInflater inflater = popupMenu.getMenuInflater();

inflater.inflate(R.menu.menu_Popup, popupMenu.getMenu());

popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

@Override

public boolean onMenuItemClick(MenuItem item) {

switch (item.getItemId()) {

case R.id.action_alert:

//perform operstion

return true;

case R.id.action_delete:

//perform operstion

return true;

}

return false;

}

});

popupMenu.show();

}

});

}

当我点击删除按钮,其在红色圆圈弹出菜单需要在该按钮一侧打开,但打开的是上边的PopupMenu不recycleview正常工作

回答:

试试这个

​​

styles.xml

<style name="popupMenuStyle" parent="Theme.AppCompat.Light.DarkActionBar"> 

<item name="android:textColor">#000000</item>

<item name="android:itemBackground">#FFFFFF</item>

</style>

以上是 的PopupMenu不recycleview正常工作 的全部内容, 来源链接: utcz.com/qa/265376.html

回到顶部