BottomSheetDialogFragment
全部标签 我正在开发一个MaterialDesign应用。我想要实现的一个功能是某种民意调查。当用户单击列表中的某个元素时,应该会显示如下所示的持久BottomSheet对话框:然后,当用户单击任何按钮时,该对话框应该消失,并且应该显示模态BottomSheet对话框,为用户提供有关在开始时单击的列表项的更多信息。它看起来像这样:我找不到任何关于BottomSheetDialog和BottomSheetDialogFragment的明确解释,以及如何正确使用它们,即使在阅读了有关AppCompat对话框的一些信息之后也是如此。所以,我的问题是:它们有什么不同,我应该使用哪一个案例?如何在Acti
我正在开发一个MaterialDesign应用。我想要实现的一个功能是某种民意调查。当用户单击列表中的某个元素时,应该会显示如下所示的持久BottomSheet对话框:然后,当用户单击任何按钮时,该对话框应该消失,并且应该显示模态BottomSheet对话框,为用户提供有关在开始时单击的列表项的更多信息。它看起来像这样:我找不到任何关于BottomSheetDialog和BottomSheetDialogFragment的明确解释,以及如何正确使用它们,即使在阅读了有关AppCompat对话框的一些信息之后也是如此。所以,我的问题是:它们有什么不同,我应该使用哪一个案例?如何在Acti
这个问题在这里已经有了答案:SetstateofBottomSheetDialogFragmenttoexpanded(20个答案)关闭4年前。当我打开BottomSheetDialogFragment时,它会打开一半(意味着没有完全打开)。fragment.show(supportFragmentManager,"my_frag")我尝试使用NestedScrollView和behavior_peekHeight但没有成功。尝试不使用NestedScrollView。仅使用LinearLayout。尝试在match_parent和wrap_content之间切换高度我在BottomS
我搜索了很多但找不到任何解决方案和Snackbarisnotworkingwithinfragmentclass没有帮助。我传递了fragment的rootView并尝试从getActivity传递一个View,但它们都不起作用!@OverridepublicViewonCreateView(LayoutInflaterinflater,ViewGroupcontainer,BundlesavedInstanceState){rootView=inflater.inflate(R.layout.content_dialog_bottom_sheet,container,false);S
我最近将BottomSheetDialogFragment添加到我的应用程序,但它显示MaterialDark主题的背景颜色为白色。即使我使用android:background="?android:attr/colorBackground"对于对话框的根布局,它仍然是白色的(但是这个属性在对话框之外是可以的)。有没有人遇到过这个问题? 最佳答案 底部表单对话框的外观由名为bottomSheetDialogTheme的属性控制,defaultstoTheme.Design.Light.BottomSheetDialog。要获得深色背
问题我正在为我的模态BottomSheet使用BottomSheetDialogFragment并希望设置最大宽度,以便在平板电脑/大屏幕上BottomSheet不会占用屏幕的整个宽度。我该如何解决这个问题?谢谢!相关代码和资源fragment_bottomsheet.xml:res/values/styles.xml:match_parentmatch_parentcenter_horizontalres/values-w600dp/styles.xml:match_parent640dpcenter_horizontal 最佳答案
我正在尝试在BottomSheetDialogFragment中设置一个viewpager,但结果始终相同:java.lang.IllegalStateException:Fragmentdoesnothaveaview设置对话框代码:@OverridepublicvoidsetupDialog(Dialogdialog,intstyle){Log.d(TAG,"setupDialog");super.setupDialog(dialog,style);Viewroot=View.inflate(getContext(),R.layout.fragment_daily_detail,n
我在我的Activity中使用BottomSheetDialogFragment,对话框在纵向模式下显示全高,但在我切换到横向模式时不会显示。MainActivity.javapublicclassMainActivityextendsAppCompatActivity{@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);CustomBottomSheetDialogcustom
我正在尝试显示一个BottomSheetDialogFragment,其中包含一些EditText字段供用户输入信息。我想直接在键盘上方显示它,但它一直覆盖内容。这是我调出BottomSheetDialogFragment时发生的情况,您可以看到它正在选择CardNumberEditText,但覆盖了其他内容。理想情况下,这就是我要找的东西,您可以同时看到EditTexts和View的填充。我已经尝试了很多围绕windowSoftInputMode的解决方案,但似乎没有任何效果。我已经为父级Activity和实际的BottomSheetDialogFragment通过将其设置为adju
我正在尝试创建一个内部带有TextInputLayout的BottomSheetDialogFragment。我将此BottomSheet设置为adjustResize以防止键盘覆盖TextInputLayout。问题是我在使用不同的Android版本时会出现不同的行为。这是布局:这是BottomSheetDialogFragment:publicclassTestFragmentextendsBottomSheetDialogFragment{@Nullable@OverridepublicViewonCreateView(LayoutInflaterinflater,@Nullab