Reputation: 1072
I got stucked and what I wanna do, is, after clicking on "Create new acc" another fragment(Fragment B) should appear above current one (Fragment A). If user click on "save" button, inserted information will be proccessed and fragment (Fragment B) has to be closed. For better illustration image is included.
How should I implement such a composition ? What is the best way to do that ? Thanks in advance.
Upvotes: 1
Views: 315
Reputation: 1
You can create a custom dialog and set its content to a customized layout.
public class CustomDialog extends Dialog{
public CustomDialog(Context context){
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_custom);
}
}
Upvotes: 0
Reputation: 104
you can also do with simple dialogue box(applied if not using fragments and using activities).Because fragments cant be shown in dialogue boxes.Just by inflating the a view.
Upvotes: 0
Reputation: 55340
Your best bet would be to use a DialogFragment
.
You can add, remove, replace them like any other fragment (via FragmentManager
) and their implementation is almost the same (i.e. implement onCreateView()
and the framework will take care of the rest.
See this article or the official documentation.
Upvotes: 0
Reputation: 2792
DialogFragment
Displays a floating dialog. Using this class to create a dialog is a good alternative to using the dialog helper methods in the Activity class, because you can incorporate a fragment dialog into the back stack of fragments managed by the activity, allowing the user to return to a dismissed fragment.
Upvotes: 2