Below is my code, menu - ImageView menubottom - ImageView My requirement is to display the menubottom image when the popup is shown.
menu.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{View layout=(View)getLayoutInflater().inflate(R.layout.navigationbar, null);
popupWindow = new PopupWindow(getApplicationContext());
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setContentView(layout);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(swidth);
popupWindow.setFocusable(false);
popupWindow.setOutsideTouchable(true);
popupWindow.setAnimationStyle(-1);
if(x==1)
{ popupWindow.showAsDropDown(menubottom);
menubottom.setVisibility(View.VISIBLE);
x=0;
}
else
{
popupWindow.dismiss();
popupWindow=null;
}
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
// TODO Auto-generated method stub
menubottom.setVisibility(View.INVISIBLE);
x=1;
}
});
}
}
ISSUE: When the menu button is clicked popup shows and menubottom shown. On pressing menu again, the popupmenu is hidden and then shown again.
On pressing outside the popupmenu, its working as expected(popup and menubottom is hidden)
I think, setOnDismissListener triggers the menu.setOnClickListener again. Thanks in Advance.
Aucun commentaire:
Enregistrer un commentaire