How to display dialog with custom view
Closed this issue · 1 comments
ripal commented
Hi friends,
I did not able to locate any wiki or doc about how to use this library to display dialog with custom view. Is there any feature available? How to use it?
zserge commented
Hi @ripal and sorry for a late reply. Anvil only deals with views. You can then use Anvil views inside Activities, Fragments or Dialogs as you would use any other view object.
For dialogs you can do:
myDialog.setContentView(new RenderableView() {
public void render() {
// your Anvil layout and data bindings here
}
});
Also you can pass RenderableViews into dialog builders:
new AlertDialog.Builder(getContext()).setView(new MyRenderableView(getContext()))
For Activities and Fragments the story is similar - just create Anvil views and use them as content views.