Use (convert) PopupWindow in Android and androidpopupwindow
Problems encountered after learning:
To reference: There are several, which can be solved with the error prompt;
Import android. widget. PopupWindow;
Import android. widget. Toast;
Activity call process:
First, define a BUTTON variable and mContext
Private Button mshowBtn;
Private Context mContext;
@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
StartService (new Intent (LoginActivity. this, MicroVideoService. class ));
BindXMPPService ();
SetContentView (R. layout. loginpage );
MContext = this;
InitView ();
}
// Specify the event
MshowBtn = (Button) findViewById (R. id. showbtn );
MshowBtn. setOnClickListener (mshowBtnOnClickListener );
// Implement and call the event
Private OnClickListener mshowBtnOnClickListener = new OnClickListener (){
@ Override
Public void onClick (View v ){
ShowPopWindow (mContext, v );
}
};
(