android-dialogfragment

How to create a DialogFragment without title?

走远了吗. 提交于 2019-11-27 02:36:08
I'm creating a DialogFragment to show some help messages regarding my app. Everything works fine besides one thing: There is a black stripe at the top of the window that shows the DialogFragment, that I presume is reserved for the title, something I don't want to use. This is specially painful since my custom DialogFragment uses a white background, so the change is way too notorious to be left aside. Let me show you this in a more graphical manner: Now the XML code for my DialogFragment is as follows: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=

DialogFragment not resizing when keyboard shown

早过忘川 提交于 2019-11-27 01:51:11
问题 I'm trying to use a SherlockDialogFragment to ask some input from the user. Everything works fine on my phone (Galaxy Nexus, 4.2), but on a smaller phone (emulator 2.3.3), when the keyboard shows up, it covers the two buttons of the DialogFragment, like this: My layout is inside a ScrollView, and I'm changing the softInputMode to SOFT_INPUT_ADJUST_RESIZE on my onViewCreated . I also tried SOFT_INPUT_ADJUST_PAN , and it didn't work MyCustomDialog.java public class AddTaskDialog extends

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState with DialogFragment

五迷三道 提交于 2019-11-27 01:46:12
问题 I am facing issue with DialogFragment / getSupportFragmentManager / Android version 4.x 01-10 19:46:48.228: E/AndroidRuntime(9879): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState 01-10 19:46:48.228: E/AndroidRuntime(9879): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1314) 01-10 19:46:48.228: E/AndroidRuntime(9879): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1325) 01-10 19:46:48

Make bottomSheetDialog full screen over status bar

丶灬走出姿态 提交于 2019-11-27 01:23:50
问题 I recently used android.support.design.widget.BottomSheetDialogFragment. I wanted to do something which is similar to the Google contact app, its BottomSheet can overlay the toolbar and statusbar. However, when I use the BottomSheetDialogFragment to implement this, it turns out to this: As you can see the activity's toolbar is still visible. Here is my code of the BottomSheetDialogFragment : public class KeyDetailFragment extends BottomSheetDialogFragment { private BottomSheetBehavior

ViewPager in DialogFragment - IllegalStateException: Fragment does not have a view

我们两清 提交于 2019-11-27 01:16:10
问题 What I want to achieve From a FragmentActivity show a dialog when clicking an Action Button in the Action Bar DialogFragment - A Dialog without title TabHost - Tabs at the top of the dialog ViewPager with FragmentPagerAdapter - Swipable, which content is connected to the Tabs 2-3 Dialog Buttons (different subclasses of the Dialog, different buttons) - Are not supposed to be in one of the ViewPager 's Fragment , meaning the same buttons should remain at the bottom of the Dialog regardless of

How to change the background color around a DialogFragment?

陌路散爱 提交于 2019-11-27 00:51:31
I'm building a custom DialogFragment . The dialog layout is set to my_dialog.xml , but how can I modify the color around the dialog (the transparent grey)? my_dialog.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" > <TextView android:id="@+id/hello" android:layout_width="100dp" android:layout_height="100dp" android:background="@android:color/holo_orange_light" android:gravity="center" android:text="hello" /> </RelativeLayout> MyDialogFragment.java public class

Android DialogFragment disappears after orientation change

余生颓废 提交于 2019-11-27 00:42:15
问题 I have a FragmentActivity support v4 class which implements two side by side (kind of like gmail) fragments and a button which can bring up a DialogFragment. This all works great unless I have an orientation change. When I have an orientation change the states of the Fragments are not saved. And the main problem is if I have a the FragmentDialog open, it simply disappears. I have set setRetainInstance(true); in all fragments but it did not help. In my manifest I included android:configChanges

How to make DialogFragment width to Fill_Parent

被刻印的时光 ゝ 提交于 2019-11-26 22:32:27
问题 Hello I am working on an android application where I am using DialogFragment to display the dialog but its width is very small. How I can make this width to fill_parent to it ? public class AddNoteDialogFragment extends DialogFragment { public AddNoteDialogFragment() { // Empty constructor required for DialogFragment } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().setTitle(getString(R.string.app_name)); View view =

Allow outside touch for DialogFragment

北战南征 提交于 2019-11-26 22:26:20
问题 I have a Fragment in my app that shows a DialogFragment . I have in the fragment a button that closes the dialog. But when I show the dialogFragment, the touches outside from the dialog do nothing and I can't click the buttons outside from the dialog fragment. How can I allow outside touches for DialogFragment? 回答1: In order to do that, a flag of the Window that allows the outside touch should be turned on and for the good appearance the background dim flag should be cleared. Since it must be

AlertDialog with custom view: Resize to wrap the view's content

时光毁灭记忆、已成空白 提交于 2019-11-26 21:53:33
I have been having this problem in an application I am building. Please ignore all of the design shortcomings and lack of best practice approaches, this is purely to show an example of what I cannot solve. I have DialogFragment which returns a basic AlertDialog with a custom View set using AlertDialog.Builder.setView() . If this View has a specific size requirement, how do I get the Dialog to correctly resize itself to display all of the content in the custom View ? This is the example code I have been using: package com.test.test; import android.os.Bundle; import android.app.Activity; import