dialogfragment

Styling custom dialog fragment not working

风流意气都作罢 提交于 2019-12-03 03:44:34
I'm trying to style all my dialog fragments to look the same in my app. The dialogs coming from my settings fragment are styled exactly the way I want it. For my custom dialog fragments, the style is similar but not exactly the same. For some reason the spinner, timepicker, datepicker, radiobuttons, and edittext widgets inside my custom dialog fragments don't pick up the same style. In fact, the widgets blend in with the white background and you can't see that they are there. What am I doing wrong? <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"/> <style name="Theme.Base"

android DialogFragment android:onClick=“buttonCancel” causes IllegalStateException could not find a method

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a problem with my Dialog Fragment. I wanted to use android:onClick attribute as in my opinion code is more clear then. In my layout I have the following declaration: <Button android:id="@+id/dialog_new_database_button_cancel" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/button_cancel" android:maxLines="1" style="?android:attr/buttonBarButtonStyle" android:onClick="buttonCancel" /> Now my DialogFragment import android.os.Bundle; import android.support.v4.app

DialogFragment crashes Activity when calling startActivity()

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a DialogFragment that was supposed to be simple but it's giving me some big problems specifically on Jelly Bean. The app uses the network and it pops a dialogue asking the user to turn on WiFi or cancel then closes it. So it extends DialogFragment and creates view as: @Override public Dialog onCreateDialog ( Bundle savedInstanceState ) { AlertDialog a = new AlertDialog . Builder ( getActivity ()). setCancelable ( true ). setTitle ( R . string . dialog_title_disabled ) . setMessage ( R . string . dialog_text ) .

Correct way to remove a DialogFragment: dismiss() or transaction.remove()?

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I still have a problem due to a DialogFragment used on my main activity. I am currently using this code to remove it: FragmentTransaction transaction = getFragmentManager().beginTransaction(); Fragment frag = getFragmentManager().findFragmentByTag("LockDialog"); if(frag != null) { transaction.remove(frag); transaction.commit(); } The problem is that I am still getting crashes due to the fact that the dialog has duplicates (meaning the dialog was not properly removed sometimes). So my question is: is it a right way to remove a DialogFragment

DialogFragment with clear background (not dimmed)

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get the background of a DialogFragment to be completely clear. With setting the style item android:windowIsFloating to true (the default), the DialogFragment displays exactly how I want it to, but has a very dimmed background. By setting android:windowIsFloating to false, I get the clear background I want, but the DialogFragment blows up to about 95% of the screen, leaving only a tiny gap around it where you can see through to the view it overlays. I've tried ton's of tweaks and cannot seem to override this behavior. Do I need

Android DialogFragment onViewCreated not called

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using android compatibility library (v4 revision 8). In the custom DialogFragment the overrided method onViewCreated is not getting called.For eg. public class MyDialogFragment extends DialogFragment{ private String mMessage; public MyDialogFragment(String message) { mMessage = message; } @Override public Dialog onCreateDialog( Bundle savedInstanceState){ super.onCreateDialog(savedInstanceState); Log.d("TAG", "onCreateDialog"); setRetainInstance(true); //....do something } @Override public void onViewCreated(View view, Bundle

DialogFragment with setRetainInstanceState(true) is not displayed after the device is rotated

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a question regarding DialogFragment. I am trying to make a dialog that keeps it's state after the device is rotated. This dialog has a bunch of references to things such as adapters and other heavier objects and I need this to be kept upon rotation, if possible without having to make every reference Parcelable or Serializable in order for me to use onSaveInstanceState to save and restore them when the original activity is re-created. I've noticed there's a method called setRetainInstance(boolean) on the DialogFragment which allows you

Full Screen DialogFragment in Android

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to show an almost fullscreen DialogFragment. But I'm somehow not able to do so. The way I am showing the Fragment is straight from the android developer documentation FragmentManager f = (( Activity ) getContext ()). getFragmentManager (); FragmentTransaction ft = f . beginTransaction (); Fragment prev = f . findFragmentByTag ( "dialog" ); if ( prev != null ) { ft . remove ( prev ); } ft . addToBackStack ( null ); // Create and show the dialog. DialogFragment newFragment = new DetailsDialogFragment (); newFragment . show

Xamarin Android.App.DialogFragment Obsolete

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: TL;DR Does anyone know why Android.App.DialogFragment is obsolete in Xamarin and, more importantly, what class is recommended instead? More Info: I'm getting the following warnings in my Xamarin.Android app: Warning CS0618 'DialogFragment' is obsolete: 'This class is obsoleted in this android platform' Warning CS0618 'Activity.FragmentManager' is obsolete: 'deprecated' from the following code: using Android.App; void onClick(int pos) { DialogFragment newFragment = new UsernameDialogFragment(_scans[pos]); newFragment.Show(_activity

DialogFragment issues with screen orientation and MediaController

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an app which plays videos in a DialogFragment . I have added MediaController to the VideoView however there are two issues: MediaController is hidden behind the DialogFragment . Change in screen orientation when the DialogFragment is visible results in an exception that the activity has a leaked window For the first one, I tried using linearLayoutParent.bringChildToFront(mediaControls) which did not work. And I do not know how to deal with the second one. Help me out. :) 回答1: Although this is an old question, I was also displaying a