The Code:
public class CameraDialogFragment : DialogFragment
{
ImageButton camera;
ImageButton gallery;
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
var view = inflater.Inflate(Resource.Layout.CameraDialog, container, true);
gallery = view.FindViewById<ImageButton>(Resource.Id.imageButton2);
gallery.Click += delegate {
};
camera = view.FindViewById<ImageButton>(Resource.Id.imageButton1);
camera.Click += delegate {
};
return view;
}
public override void OnResume()
{
Dialog.Window.SetLayout(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
Dialog.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
SetStyle(DialogFragmentStyle.NoFrame, Resource.Style.YouthImpactTheme);
base.OnResume();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
}
The XML:
<?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">
<ImageButton
android:src="@drawable/Camera3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton1" />
<ImageButton
android:src="@drawable/Gallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton2" />
</LinearLayout>
The result:
Excellent! It is very useful for android developers.
ReplyDeleteandroid app developers india