Transparent Alert Dialog box - android

I have few doubts regarding transparent AlertDialog box in android.I have created the alert dialog box using AlertDialog.builder in the camera surface view but i want Transparent alert dialog box is it possible. please help me
Regards
Raj

Use this
The code is as follows
Dialog mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
Answer taken from a similar answer here

Yes, this is possible. I believe you can do it by creating a custom alert dialog:
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
you can then set the background of your custom dialog to transparent like so:
this.getWindow().setBackgroundDrawableResource(R.drawable.transparent);
(where "R.drawable.transparent" is a reference to the color "#00000000")

Related

Android default alertdialog background color that is not created by me

I wanna change only default alert dialog backgound but i didn'tfind anything usefull. I don't wanna change custom alert dialog them. I did it . The only thing i want to change default alert dialog background color. How can i change alert dialog backgroudn that is not created by me ?
In short on run time permissions dialog, you can't customize it.
When your app calls requestPermissions(), the system shows a standard dialog box to the user. Your app cannot configure or alter that dialog box. If you need to provide any information or explanation to the user, you should do that before you call requestPermissions(), as described in Explain why the app needs permissions.’
If you want to change the background of alertdialog, use belwo code:
Add this line and you will able to change the background color of alert dialog.
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Say Hello!");
builder.setMessage("Are you want to do this?");
AlertDialog dialog = builder.create();
dialog.show();
dialog.getWindow().setBackgroundDrawable(newColorDrawable(Color.Blue));
You want to change runtime permission request dialog colors I suppose. You can't customize those alert dialogs. They are default.
Take a look into this answer:
How can I customize permission dialog in Android?

Handling textview hit bottom in alert dialog

I'm setting a message in a simple alert dialog. I need to know if the user has read all the text inside the dialog or not. Is there any way to set a scroll listener or something in an alert dialog?
Create your custom dialog and then set some listener to your custom View. Here's a good example: http://www.mkyong.com/android/android-custom-dialog-example/
and
https://stackoverflow.com/a/10713501

How to create a PopupWindow with images?

I'm trying to create a popup window similar to programmatically. Unfortunately I couldn't figure out any helpful resource so far for creating a similar popup.
You can do it with Dialog
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.chat_custom_dialog);
dialog.setTitle("custom dialog");
dialog.show();
where dialog.setContentView(R.layout.chat_custom_dialog); will set the layout of the dialog.
And if you want to update the dialog's layout views you can call the dialog.findViewById(id) to get the view inside of the layout same as what you are doing in the activity

Creating a Dialog with dimmed background

I've created a Dialog that appears when a button is clicked. I made a custom layout for it and coded it like this:
final Dialog dialog = new Dialog (CheckpointsActivity.this, android.R.style.Theme_Translucent);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.alert_continue);
//rest of the code...
This is how the Dialog looks now:
And this is how I want it to look like:
It should be a lot darker in the background with a gradient effect. I can't seem to find any info on how to achieve this.
You can make a dialog box with the same background and gradient and then make the ui on top of that.

display a view when an activity starts

I need to display a certain view when an activity starts, and when the user click ckecked to dismiss the view. It look like this
:
Has anyone an idea how can I do this? Any idea is welcome.
Yes, you can use a custom dialog
just create a custom XML and inflate it into your dialog object
Dialog dialog = new Dialog(mContext);
dialog.setContentView(R.layout.custom_dialog);
dialog.show();
and then dismiss it by calling dialog.dismiss();
create custom dialog using below link and open it when activity starts...
you need to increase the margin to proivde more spaces
Have a look at custom dialog examples -
custom dialog 1
custom dialog 2
yes, you can use PopupWindow for Creating window
see these tutorila for adding PopupWindow in your Activity:
Using the PopupWindow class in Android apps
Example of using PopupWindow
You could use a RelativeLayout for this. When the user clicks check, the visibility of the 'upper' layout must be set to GONE.

Categories

Resources