Headertab

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, 30 September 2016

Transparent dialogbox in android





private void showDialogBox() {


    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = LayoutInflater.from(getActivity());


    View view = inflater.inflate(R.layout.dialog_logout, null);
    dialogBuilder.setCancelable(false);


    TextViewMedium logout = (TextViewMedium) view.findViewById(R.id.tvm_logout);


    logout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(getActivity(), SplashActivity.class));
            dialog.dismiss();
        }
    });
    dialogBuilder.setView(view);

    dialog = dialogBuilder.create();

//Make transparent your dialogbox background
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));


// Yoc can open dialogbox where you decide top,bottom,left,right.... 
    Window dialogWindow = dialog.getWindow();
    WindowManager.LayoutParams lp = dialogWindow.getAttributes();
    dialogWindow.setGravity(Gravity.CENTER | Gravity.CENTER);

    dialog.show();


}

No comments:

Post a Comment