I am working on a custom toast and the code snippet is as show below i am inflating custom layout for this purpose where i need to set the layout parameters pragmatically,
Context context = getApplicationContext();
// Create layout inflator object to inflate toast.xml file
LayoutInflater inflater = getLayoutInflater();
// Call toast.xml file for toast layout
View toastcreation = inflater.inflate(R.layout.toast, null);
Toast toast = new Toast(context);
// Set layout to toast
toast.setView(toastcreation );
//how to set parameters programatically here??
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
i need to make it center horizontal and cemter vertical.
as also i am using toast.setDuration(Toast.LENGTH_LONG);
, can time length explicitly be shown rather than using Toast.LENGTH_LONG