回答編集履歴

2

イベントハンドラ作成でよかったので修正

2016/08/31 16:24

投稿

退会済みユーザー
test CHANGED
@@ -24,25 +24,7 @@
24
24
 
25
25
  **追記**
26
26
 
27
- 気になって確認したところ、
27
+ 気になって確認したところ、上記の処理で動きました。
28
-
29
-
30
-
31
- ```C#
32
-
33
- button1.Click += delegate
34
-
35
- {
36
-
37
- //ここに処理
38
-
39
- };
40
-
41
- ```
42
-
43
-
44
-
45
- 上記の処理で動きました。
46
28
 
47
29
 
48
30
 

1

気になってたので確認してみた。

2016/08/31 16:24

投稿

退会済みユーザー
test CHANGED
@@ -19,3 +19,93 @@
19
19
 
20
20
 
21
21
  な感じでいけませんか?
22
+
23
+
24
+
25
+ **追記**
26
+
27
+ 気になって確認したところ、
28
+
29
+
30
+
31
+ ```C#
32
+
33
+ button1.Click += delegate
34
+
35
+ {
36
+
37
+ //ここに処理
38
+
39
+ };
40
+
41
+ ```
42
+
43
+
44
+
45
+ 上記の処理で動きました。
46
+
47
+
48
+
49
+ > Xamarin.Android(C#)でCanvas上にButtonを設置する方法を教えてください。
50
+
51
+
52
+
53
+ が主な質問と思いますが、axmlを以下の様な感じ(位置とかは気にしないでください)でいけました。
54
+
55
+
56
+
57
+ ```axml
58
+
59
+ <?xml version="1.0" encoding="utf-8"?>
60
+
61
+ <RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android"
62
+
63
+ p1:minWidth="25px"
64
+
65
+ p1:minHeight="25px"
66
+
67
+ p1:layout_width="fill_parent"
68
+
69
+ p1:layout_height="fill_parent"
70
+
71
+ p1:id="@+id/relativeLayout1">
72
+
73
+ <jpeg2000test.jpeg2000test.View_C
74
+
75
+ p1:layout_width="match_parent"
76
+
77
+ p1:layout_height="match_parent" />
78
+
79
+ <Button
80
+
81
+ p1:layout_marginLeft="200.0dp"
82
+
83
+ p1:layout_marginTop="200.0dp"
84
+
85
+ p1:layout_width="200dp"
86
+
87
+ p1:layout_height="70dp"
88
+
89
+ p1:id="@+id/btnOne"
90
+
91
+ p1:textSize="30dp"
92
+
93
+ p1:text="ボタン"
94
+
95
+ />
96
+
97
+ </RelativeLayout>
98
+
99
+ ```
100
+
101
+
102
+
103
+ CustomViewを記述する方法が、バージョンによってちょっと違うようなので気をつけたほうが良さそうです。
104
+
105
+ [https://forums.xamarin.com/discussion/comment/122750/#Comment_122750](https://forums.xamarin.com/discussion/comment/122750/#Comment_122750)
106
+
107
+
108
+
109
+ ![イメージ](209c39068d9a0d188603e48ebbc2bc20.png)
110
+
111
+