Guest User

Untitled

a guest
Mar 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. Cocosw.BottomSheetActions.BottomSheet.Builder b = new Cocosw.BottomSheetActions.BottomSheet.Builder (this);
  2. b.Title ("New");
  3. b.Sheet (Resource.Layout.menu_bottom_sheet)
  4.  
  5. button.setOnClickListener(new View.OnClickListener() {
  6. public void onClick(View v) {
  7. // Perform action on click
  8. }
  9. });
  10.  
  11. class BottomSheetActions : IDialogInterfaceOnClickListener {
  12. public void OnClick (IDialogInterface dialog, int which) {
  13. Console.WriteLine ("Hello fox");
  14. }
  15.  
  16. public IntPtr Handle { get; }
  17.  
  18. public void Dispose() {
  19.  
  20. }
  21. }
  22.  
  23. b.Listener (new BottomSheetActions());
  24.  
  25. internal class BottomSheetActions : Java.Lang.Object, IDialogInterfaceOnClickListener
  26. {
  27. public void OnClick (IDialogInterface dialog, int which)
  28. {
  29. Console.WriteLine ("Hello fox");
  30. }
  31. }
  32.  
  33. button.Click += delegate
  34. {
  35. //Your code
  36. };
  37.  
  38. you can use the custom layout for bottomsheetdialog by using below code:
  39.  
  40. **CustomLayout:**
  41. <?xml version="1.0" encoding="utf-8"?>
  42. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  43. xmlns:local="http://schemas.android.com/apk/res-auto"
  44. android:orientation="vertical"
  45. android:background="#FAFAFA"
  46. android:layout_width="match_parent"
  47. android:layout_height="match_parent">
  48. <TextView
  49. android:textSize="16sp"
  50. android:layout_weight="1"
  51. android:gravity="center"
  52. android:background="#ffffff"
  53. android:textColor="#B0BEC5"
  54. android:layout_width="match_parent"
  55. android:layout_height="match_parent"
  56. android:text="Are You Going to Use map?"
  57. android:textAlignment="gravity"
  58. android:padding="20dp" />
  59. <LinearLayout
  60. android:padding="20dp"
  61. android:layout_weight="3"
  62. android:scrollbars="horizontal"
  63. android:orientation="horizontal"
  64. android:layout_width="match_parent"
  65. android:layout_height="match_parent"
  66. android:paddingBottom="2dp">
  67. <Button
  68. android:elevation="5dp"
  69. android:textSize="16sp"
  70. android:layout_weight="1"
  71. android:gravity="center"
  72. android:background="@drawable/btnselector"
  73. android:textColor="#90CAF9"
  74. android:layout_width="match_parent"
  75. android:layout_height="match_parent"
  76. android:text="No"
  77. android:textAlignment="gravity"
  78. android:layout_margin="10dp" />
  79. <Button
  80.  
  81. android:id="@+id/btnyes"
  82. local:MvxBind="Click Confyes"
  83. android:textSize="16sp"
  84. android:focusable="true"
  85. android:focusableInTouchMode="true"
  86. android:elevation="5dp"
  87.  
  88. android:layout_weight="1"
  89. android:gravity="center"
  90. android:background="@drawable/btnselector"
  91. android:textColor="#90CAF9"
  92. android:layout_width="match_parent"
  93. android:layout_height="match_parent"
  94. android:text="Yes"
  95. android:layout_margin="10dp" />
  96. </LinearLayout>
  97. </LinearLayout>
  98.  
  99. **MainActivity**
  100.  
  101.  
  102. BottomSheetDialog BSheetdialog = new BottomSheetDialog(this);
  103. BSheetdialog.SetContentView(Resource.Layout.termconditionpopup);
  104. var yes = dialog.FindViewById(Resource.Id.btnyes);
  105. yes.RequestFocus();
  106. yes.Click += delegate {
  107. //Your Code Here
  108. }
Add Comment
Please, Sign In to add comment