You can use the PopupWindow which starts from API level 1.
In PopupWindow you can actually design something with XML Layout file.
You can include anything (TextView,Button,ImageView,...) Like :
PopUp Window XML :
Main Activity XML :
And you can Pop It Up in Activity like :
package com.example.popup;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.PopupWindow;
public class MainActivity extends Activity {
Button open;
LayoutInflater inflater;
View popUpView;
PopupWindow popupWindow;
Button close;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
open = (Button)findViewById(R.id.idOpen);
open.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popupWindow.showAsDropDown(open);
}
});
inflater =(LayoutInflater) getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
popUpView = inflater.inflate(R.layout.popup_window,null);
popupWindow = new PopupWindow(popUpView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
close = (Button)popUpView.findViewById(R.id.idClose);
close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popupWindow.dismiss();
}
});
}
}
HOPE THIS WILL HELP, HAPPY CODING :)