In Recycler View I click on a button add to cart a dialog is open. In Recycler view adapter
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.addtocart.setOnClickListener((Mp3HindiLandingActivity) context);
}
In My Activity(Mp3HindiLandingActivity)
@Override
public void onClick(final View v) {
switch (v.getId()) { case R.id.addtocart:
PopupMenu popup = new PopupMenu(ctx, v);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu1:
Toast.makeText(v.getContext(), "FriendRequest", Toast.LENGTH_LONG).show();
return true;
case R.id.menu2:
Toast.makeText(v.getContext(), "Block | Hide ", Toast.LENGTH_LONG).show();
return true;
default:
return false;
}
}
});
popup.getMenuInflater().inflate(R.menu.menu, popup.getMenu());
popup.show();
break;`
}}
It Shows the the menu below addtocart icon but I need the menu items having different background as per the image attached?