dialogfragment

While passing Android DialogFragment arguments, onCreateDialog bundle agument is unexpectedly null

风格不统一 提交于 2019-12-04 22:45:07
问题 I am trying to display a basic dialog in Android using a DialogFragment using an argument for the dialog message as described in StackOverflow thread and DialogFragment documentation. My problem is that the Bundle argument savedInstanceState in onCreateDialog always shows up as null, which means the activity displays an empty dialog box instead of one with a message. How can I get the non-null bundle contents from the newInstance factory method to show up in onCreateDialog? Or am I simply

Custom Date Time picker using NumberPicker and FragmentDialog in android

喜欢而已 提交于 2019-12-04 21:26:56
I want to a custom Date Time Picker Dialog exactly as shown in the image. In my project this is dialog is shown when clicked on a TextView which is in a Fragment . I know that I need to use NumberPickers which populates the dates From Current date till all the dates next week. The default android date and time pickers doesnt fit my required so I need to create my own custom `DateTimePicker fragmentDialog'. My required DateTimePicker <LinearLayout android:background="@color/background_default_white" style="@style/LinearPageLayout" xmlns:android="http://schemas.android.com/apk/res/android">

项目遇到的问题

人走茶凉 提交于 2019-12-04 15:06:47
postdelayed方法:延迟加载计时器。 保留两位小数 关于dialogFragment中的一些细节问题: 1.关于view中控件绑定初始化,必须在onViewCreated中初始化 2.关于宽高问题:xml文件中的布局每一个都设置top,因此高度已经固定。仅需在dialogfragment文件中的onResume()/onStart()方法中设置对应的宽度即可。 3.onCreateView中设置透明背景色 dialog.window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))4.对每一个getdialog,getdialog.getWindow都需要判空,防止空指针5.所有用到glide第三方框架的部分,都写到ImageLoaderUtils中(以后如果换框架方便)6.布局中,每个都用到了 android:layout_gravity="center"直接在父布局中写一个就可以 7.关于进出动画效果,我们自己的DialogUtils中已经定义了,setDIalogWindow中为动画的出现与消失动画 来源: https://www.cnblogs.com/acg88688/p/11870586.html

Hide to show and hide keyboard in DialogFragment

孤街浪徒 提交于 2019-12-04 12:26:18
问题 In my dialog fragment, I am able to show the keyboard using getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT STATE_VISIBLE); but I am not able to hide it on dismiss . I've tried getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); and getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); neither of which work. I've also tried showing and hiding the keyboard using

How to take text input with DialogFragment in Android?

馋奶兔 提交于 2019-12-04 01:44:47
问题 I am trying to get a value that user enters into a Dialog, using the recommended DialogFragment class for it, the Dialog constructs and runs fine, but I cannot return the value of the EditText parameter to the parent class, without get a Null pointer exception. My DialogHost class, this constructs, returns and links the parent to its buttons. package jo.app.co; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import

DialogFragment 不可取消和点击外部不消失

喜夏-厌秋 提交于 2019-12-04 01:14:09
在最近的项目开发中需要通过短信验证码登录,实现中需要用到DialogFragment来实现验证码输入框,具体效果如下图: TIM图片20170921105551.jpg 但是在具体使用过程中可能不小心触碰到透明背景,导致DialogFragment触发消失,那么怎么屏蔽呢? 原先在Activity显示Dialog,直接设置就可以了。如下所示: alertDialog.setCancelable(false); alertDialog.setCanceledOnTouchOutside(false); 那么在DialogFragment并没有这样的方法,应该怎么实现呢?经过谷歌一番之后,找到了 网上的做法 http://blog.csdn.net/guijiaoba/article/details/50680726 这篇文章的方法,确实也可以实现,但是总感觉很复杂。 我们的做法 经过一番摸索之后,我发现在DialogFragment中有一个getDialog的方法,返回的是DialogFragment中的Dialog对象,那么现在我只需要操作这个Dialog对象就行; 在使用的时候: DialogFragment.getDialog.setCancelable(false); DialogFragment.getDialog.setCanceledOnTouchOutside

DialogFragment is always resized when soft keyboard is opened

廉价感情. 提交于 2019-12-03 15:41:26
I'm having some issues with an custom DialogFragment that is displayed Fullscreen. This dialog has content that is scrollable and has an autocompletetextview. Initially the dialog is displayed with an margin at the top - set programmatically as an transparent view at the top of the layout content. As soon as the autocompletetextview is focused, this margin is reduced to 0 (thus giving the illusion that the dialog is getting in fullscreen mode). At this moment the keyboard is also showed. Currently, the keyboard reduced the size of the dialog and an button that is on the dialog is moved up,

While passing Android DialogFragment arguments, onCreateDialog bundle agument is unexpectedly null

冷暖自知 提交于 2019-12-03 14:36:35
I am trying to display a basic dialog in Android using a DialogFragment using an argument for the dialog message as described in StackOverflow thread and DialogFragment documentation . My problem is that the Bundle argument savedInstanceState in onCreateDialog always shows up as null, which means the activity displays an empty dialog box instead of one with a message. How can I get the non-null bundle contents from the newInstance factory method to show up in onCreateDialog? Or am I simply missing something else? The only significant difference I see from the documentation is that I am using a

Should an internal DialogFragment class be static or not?

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This is a snippet of code from my project that I am using to learn Android: As you can see I must add @SuppressLint to make my app work but on the guide this annotation wasn't necessary. What am I doing wrong? Here are my imports: import android . annotation . SuppressLint ; import android . app . Activity ; import android . app . AlertDialog ; import android . app . Dialog ; import android . content . Context ; import android . content . DialogInterface ; import android . content . Intent ; import android . location .

Hide to show and hide keyboard in DialogFragment

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 07:35:39
In my dialog fragment, I am able to show the keyboard using getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT STATE_VISIBLE); but I am not able to hide it on dismiss . I've tried getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); and getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); neither of which work. I've also tried showing and hiding the keyboard using InputMethodManager inputManager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);