
此片段在此处使用(在使用< fragment />的布局文件中),现在我想将其显示为对话框,并允许用户从那里选择一个值.
这可能是微不足道的,但经过数小时的搜索后我还没有找到答案.
我一直在玩DialogFragment,但我找不到在其中重用它的方法.我唯一能做的就是仅扩充布局并将其显示为对话框,由于缺少选择器逻辑,因此不接受该对话框.
注意:如果有任何不同,我正在使用appCompat
解决方法 您可以将当前片段更改为DialogFragment. DialogFragments可以嵌入或显示为对话框,如 documentation中所述.总结A DialogFragment can still optionally be used as a normal fragment,if desired. This is useful if you have a fragment that in some cases should be shown as a dialog and others embedded in a larger UI. This behavior will normally be automatically selected for you based on how you are using the fragment,but can be customized with setShowsDialog(boolean).
以上是内存溢出为你收集整理的android – 在AlertDialog中重用片段全部内容,希望文章能够帮你解决android – 在AlertDialog中重用片段所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)