Created
February 24, 2015 18:05
-
-
Save Kozlov-V/60c3f6b0c8ce857502aa to your computer and use it in GitHub Desktop.
Show AlertDialog in any position of the screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private CharSequence[] items = {"Set as Ringtone", "Set as Alarm"}; | |
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
builder.setItems(items, new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int item) { | |
if(item == 0) { | |
} else if(item == 1) { | |
} else if(item == 2) { | |
} | |
} | |
}); | |
AlertDialog dialog = builder.create(); | |
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); | |
WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes(); | |
wmlp.gravity = Gravity.TOP | Gravity.LEFT; | |
wmlp.x = 100; //x position | |
wmlp.y = 100; //y position | |
dialog.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment