I need to create a View
programmatically that displays some information I have. The View
should popup from the Current Activity
. Like this:
Is there any library or example? Because in Android I really have no idea on how to start
I need to create a View
programmatically that displays some information I have. The View
should popup from the Current Activity
. Like this:
Is there any library or example? Because in Android I really have no idea on how to start
You can use an Dialog
to achieve your View Requirement.
You can create an AlertDialog
problematically and add view elemets in to it.
EDIT
Reference code :
public static void wrappedImageDialog(final Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setPositiveButton("Get Pro", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setNegativeButton("No thanks", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
final AlertDialog dialog = builder.create();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogLayout = inflater.inflate(R.layout.go_pro_dialog_layout, null);
dialog.setView(dialogLayout);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.show();
}
If you want to start an Activity like a popup, you need to create an Activity and set this:
android:theme="@android:style/Theme.Dialog"
in the manifest.