android - AppCompat-styled dialog containing a fragment -


i want appcompat-styled dialog - background, title, button position, button tint etc. - containing fragment.

with custom dialogfragment oncreatedialog() can return appcompatdialog, in oncreateview() new layout can inflated , childfragmentmanager can used replace placeholder view fragment. resulting dialog otherwise empty box no buttons. can manually added dialog's layout no styling appcompat.

the same applies if make target fragment extend dialogfragment.

to appcompat buttons can use alertdialog.builder, , use .setview() set layout, can't find way set fragment content. if try childfragmentmanager.begintransaction().replace() oncreatedialog() get:

 java.lang.illegalstateexception: fragment not have view 

this seems because, after using builder.setview() or dialog.create() dialog.setview(), oncreateview() , getview() return null.

the second answer here seems cover quite comprehensively doesn't suggest favourable solution: https://stackoverflow.com/a/21418952/2645845

if override oncreateview() or getview() return view inflated get:

 android.util.androidruntimeexception: window feature must requested before adding content     @ android.support.v7.app.appcompatdelegateimplv7.throwfeaturerequestifsubdecorinstalled(appcompatdelegateimplv7.java:1479) 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -