dialog

How to set margins to a custom dialog?

[亡魂溺海] 提交于 2019-12-28 11:48:33
问题 Does anybody knows how can I set margins to a custom dialog? I'm asking because I've a custom dialog but when displayed it stretches to fill the parent, even though I set explicitly WRAP_CONTENT on the layout params. Basically, the dialog contains a listview whose elements must be scrolled down, when the elements are 1 for example, it doesn't stretch, but when more items are added, then the dialog occupies the entire screen. Any suggestions? I've trying all possible combinations of possible

用Activity 书写一个dialog

夙愿已清 提交于 2019-12-28 07:23:29
在项目中的用到弹窗时,一般都会用Dialog,其实可以使用Dialog样式的Activity来实现,只需要在注册Activity时指明theme就行。下面就记录一下这个Dialog的创建过程,以及一些遇到的坑。 第一步:创建一个DialogActivity,继承自Activity, 第二步:在注册清单里给这个Activity,添加主题样式theme, <activity android:name=".han.DialogActivity" android:label="@string/app_name" android:theme="@style/activityDialogTheme"> </activity> 其中的activityDialog 在res_values_styles.xml 下创建的一个dialog样式: <style name="activityDialogTheme" parent="@android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item><!--边框--> <item name="android:windowIsFloating">false</item><!--是否浮现在activity之上--> <item name="android

How can I control the location of a dialog when using ShowDialog to display it?

喜欢而已 提交于 2019-12-28 05:56:33
问题 This is a very trivial problem but I can't seem to find a way of solving it. It's annoying me because I feel I should know the answer to this, but I'm either searching for the wrong terms or looking at the wrong methods and properties. I have a configuration dialog that's called from two places. The first is from the button on the form which is working correctly - as you'd expect. The second is from a context menu on the notifyIcon in the system tray, but here it appears at the top left of

Show dialog with MVVM Light toolkit

笑着哭i 提交于 2019-12-28 05:10:06
问题 I have a ViewModel that needs to show a modal window (using ShowDialog() ) on a button click. The ViewModel catches the click command, but I don't want to do window.ShowDialog() within my ViewModel. I know there is a DialogMessage in MVVM Light, but that is used to show message boxes, not WPF modal windows. Any ideas on how to do this? 回答1: You should use Messenger class. On the View register a message to show window and then when you need to show it call Send method of Messenger class. You

Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f72ff0 that was originally added here

为君一笑 提交于 2019-12-28 03:43:10
问题 I am using google place api and want to fetch nearest restaurant and cafe but when i fetching that data using progress bar one error occurs class LoadPlaces extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage(Html.fromHtml("<b>Search</b><br/>Loading Places...")); pDialog.setIndeterminate(false); pDialog

Detect back button but don't dismiss dialogfragment

旧城冷巷雨未停 提交于 2019-12-28 02:39:18
问题 I have a dialogfragment for a floating dialog which includes a special keyboard that pops up when a user presses inside an EditText field (the normal IME is stopped from being displayed). I would like the keyboard to be dismissed (visibility = GONE) when the user presses the back button (just as with a normal IME service) but the dialog to remain visible. However, there does not appear to be a way to do this as far as I can see from my fairly extensive reading on SO and elsewhere. If I set

jQuery UI dialog box not positioned center screen

≡放荡痞女 提交于 2019-12-28 02:32:28
问题 I have a jQuery dialog box that is meant to position in the middle of the screen. However, it seems slightly off-center vertically. Here is the code: $('#add_box').dialog({ autoOpen: true, width: 300, modal: true, resizable: false, bgiframe:true }); Any ideas why this won't center? 回答1: If your viewport gets scrolled after the dialog displays, it will no longer be centered. It's possible to unintentionally cause the viewport to scroll by adding/removing content from the page. You can recenter

Open directory dialog

夙愿已清 提交于 2019-12-28 01:38:37
问题 I want the user to select a directory where a file that I will then generate will be saved. I know that in WPF I should use the OpenFileDialog from Win32, but unfortunately the dialog requires file(s) to be selected - it stays open if I simply click OK without choosing one. I could "hack up" the functionality by letting the user pick a file and then strip the path to figure out which directory it belongs to but that's unintuitive at best. Has anyone seen this done before? 回答1: You can use the

How to create a dialog with “yes” and “no” options?

北城以北 提交于 2019-12-27 10:28:31
问题 I am going to make a button to take an action and save the data into a database. Once the user clicks on the button, I want a JavaScript alert to offer “yes” and “cancel” options. If the user selects “yes”, the data will be inserted into the database, otherwise no action will be taken. How do I display such a dialog? 回答1: You’re probably looking for confirm(), which displays a prompt and returns true or false based on what the user decided: if (confirm('Are you sure you want to save this

How to check if activity is in foreground or in visible background?

删除回忆录丶 提交于 2019-12-27 10:17:37
问题 I have a splash screen on a timer. My problem is that before I finish() my activity I need to check that the next activity has started because a system dialogue box pops-up and I only want to finish() ; once the user has selected an option from the dialogue box? I know that there are many questions on how to see if your activity is in the foreground but I do not know if this allows for dialogue boxes on top of the activity too. Here is the problem, the red is my activity which is in the