android-alertdialog

Alert dialog shown but not visible

会有一股神秘感。 提交于 2019-12-22 07:59:19
问题 I have an activity where I start the built-in camera using onActivityResult. After taking a picture, I go back to my application and show a pop up asking to the user if he wants to take more pictures or no. It works fine, but after taking the picture, when I press the "save" button on the built-in camera app, and inmediatly I press the home button, If I go back to my application, my activity is visible but not active and the popup that should be visible is there but I cannot see it. If I

EditText in dialog android

 ̄綄美尐妖づ 提交于 2019-12-22 07:52:19
问题 i have made a edittext in a dialog but i cant get to change the height. AlertDialog.Builder editalert = new AlertDialog.Builder(this); editalert.setTitle("messagetitle"); editalert.setMessage("here is the message"); final EditText input = new EditText(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT); input.setLayoutParams(lp); editalert.setView(input); editalert.setPositiveButton("Send via email"

Custom Support Dialog Fragment text is the wrong color

萝らか妹 提交于 2019-12-22 07:09:37
问题 If I put a TextView in a custom dialog box, the text will be black by default. Unfortunately, the support fragment dialogs backgrounds are dark gray. Black on gray is very hard to read. I could change the TextView to white or something like android:textColor="?android:attr/textColorPrimaryInverseDisableOnly" . But the dialog boxes on the new android (Holo Light) are white. So it will be white on white. I could use a hack like forcing it to be white on old versions of Android and forcing it to

How to display Toast from AlertDialog?

耗尽温柔 提交于 2019-12-22 06:50:04
问题 When the user clicks on the save button, an AlertDialog appears and asks the user to input text for the file name. If the user clicks the positive button ("Ok") without specifying a name, I want to display a toast which asks them to do so, and keep the AlertDialog open. But the toast never displays and the dialog closes. The code for the AlertDialog is here: AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.save_game); alert.setMessage(R.string.request_name);

Unable To Hide Navigation Bar during AlertDialog/LoginDialog

点点圈 提交于 2019-12-22 05:26:14
问题 I'm attempting to hide the navigation bar globally through my app running Android 4.2.2 I have managed to use the following (admitadly hackish) method of implementing: getWindow().getDecorView().setSystemUiVisibility(8); Which successfully removes the Navigation bar (the fact it is hackish is perfectly fine - this is for a kiosk so it will only be installed on a limited number of devices) Now I'm attempting to remove the navigation bar in places other than my MainActivity - such as when it

How to create a fully customized Alert Dialog?

痞子三分冷 提交于 2019-12-22 00:29:51
问题 Is there a solution to create an Alert Dialog with no borders around? If I create a layout and attach it to the Alert Dialog , I have my layout shown, but it's surrounded by the default dialog borders. Any way to cut them off? Thanks in advance. 回答1: Here is one way (if you don't like this particular example with the green border, scroll below to see a second one I found). Here is another example (this one gives you an example without a border, and one with a border. The explanations are in

AlertDialog with spinner on start of activity

和自甴很熟 提交于 2019-12-22 00:18:33
问题 I am trying to create an AlertDialog with a spinner on the start of an activity. I have the following code within the activity's onCreate() method. AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog alertDialog; Context mContext = getApplicationContext(); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.custom_dialog, (ViewGroup) findViewById(R.id.layout_root)); Spinner spinner =

Android AlertDialog title font

主宰稳场 提交于 2019-12-21 22:23:51
问题 I am trying to change the font of android.support.v7.app.AlertDialog title text. METHOD 1 : TextView title = (TextView) dialog.findViewById(android.R.id.title); //returns null METHOD 2 : final int titleId = context.getResources().getIdentifier("alertTitle", "id", "android"); TextView title = (TextView) dialog.findViewById(titleId); //Also returns null. Is there any other way to get the title TextView ? Please note I do not want to use a custom layout. Thanks. 回答1: I got it to work using this

Multiple choice alert dialog with custom row layout

微笑、不失礼 提交于 2019-12-21 20:19:12
问题 I need to create an AlertDialog with multiple choice items but I'm having some trouble trying to set a custom layout file to the internal ListView. For single choice items I use a constructor that takes a ListAdapter as parameter and this way I can set the proper layout resource for each row: builder.setSingleChoiceItems(new ArrayAdapter<String>(getActivity(), R.layout.list_item_single_choice_answer, items), checkedItem, new DialogInterface.OnClickListener() { @Override public void onClick

How do you keep the Navigation Bar hidden when opening dialogs?

扶醉桌前 提交于 2019-12-21 17:52:40
问题 I have a theme that has a Theme.AppCompat.Dialog parent. The thing is all my activities keeps the navigation bar hidden, but when a dialog is opened, it returns with a sometimes black and sometimes transparent background color. Is there a way to keep it hidden during opening dialogs? 回答1: I finally solved this by overriding the show() method of the custom dialog that I have. @Override public void show() { // Set the dialog to not focusable. getWindow().setFlags(WindowManager.LayoutParams.FLAG