I have an app where the user can make bookings. I'm trying to implement a dialog where the user can navigate through customizing his booking, i.e.
- Pick the date
- Add extras
- View quote
- Confirm Booking
I wrote a layout to display navigation steps to the user (forward, back, cancel etc), but I want the steps mentioned above to have it's own fragment/layout. I should also mention that the initial call to create the dialog is from a fragment.
Does anyone know how to achieve this? I get a No view found for Fragment-bookingCustomization_DatePicker
error
private Dialog dialog;
private void BtnMakeBooking_Click(object sender, EventArgs e)
{
dialog = new Dialog(this.Activity);
dialog.RequestWindowFeature((int)WindowFeatures.ContextMenu);
dialog.SetTitle("Booking Customization");
dialog.SetContentView(Resource.Layout.Fragment_booking_customization);
Fragment_bookingCustomization_DatePicker date = new Fragment_bookingCustomization_DatePicker();
var fragManager = FragmentManager.BeginTransaction();
fragManager.Replace(Resource.Id.relativeLayout1, date);
fragManager.Commit();
dialog.Show();
}
Fragment_booking_customization.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px">
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:text="Back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/red_button"
android:drawableLeft="@drawable/ic_action_previous_item"
android:id="@+id/btn_bookingcustomization_cancel" />
<Button
android:text="Next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/red_button"
android:drawableRight="@drawable/ic_action_next_item"
android:id="@+id/btn_bookingcustomization_next" />
</LinearLayout>
<Button
android:text="Confirm Booking"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/red_button"
android:drawableRight="@drawable/ic_action_accept"
android:id="@+id/btn_bookingcustomization_confirm"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" />
<Button
android:text="Cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/red_button"
android:drawableRight="@drawable/ic_action_remove"
android:id="@+id/btn_bookingcustomization_cancel" />
</LinearLayout>
Fragment_bookingCustomization_DatePicker.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px">
<DatePicker
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/datePicker1" />
</LinearLayout>
Fragment_bookingCustomization_DatePicker.cs
public class Fragment_bookingCustomization_DatePicker : Fragment
{
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Create your fragment here
}
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater.Inflate(Resource.Layout.Fragment_bookingCustomization_DatePicker, container, false);
return rootView;
}
}