回答編集履歴
2
イベントハンドラ作成でよかったので修正
answer
CHANGED
@@ -11,17 +11,8 @@
|
|
11
11
|
な感じでいけませんか?
|
12
12
|
|
13
13
|
**追記**
|
14
|
-
気になって確認したところ、
|
14
|
+
気になって確認したところ、上記の処理で動きました。
|
15
15
|
|
16
|
-
```C#
|
17
|
-
button1.Click += delegate
|
18
|
-
{
|
19
|
-
//ここに処理
|
20
|
-
};
|
21
|
-
```
|
22
|
-
|
23
|
-
上記の処理で動きました。
|
24
|
-
|
25
16
|
> Xamarin.Android(C#)でCanvas上にButtonを設置する方法を教えてください。
|
26
17
|
|
27
18
|
が主な質問と思いますが、axmlを以下の様な感じ(位置とかは気にしないでください)でいけました。
|
1
気になってたので確認してみた。
answer
CHANGED
@@ -8,4 +8,48 @@
|
|
8
8
|
};
|
9
9
|
```
|
10
10
|
|
11
|
-
な感じでいけませんか?
|
11
|
+
な感じでいけませんか?
|
12
|
+
|
13
|
+
**追記**
|
14
|
+
気になって確認したところ、
|
15
|
+
|
16
|
+
```C#
|
17
|
+
button1.Click += delegate
|
18
|
+
{
|
19
|
+
//ここに処理
|
20
|
+
};
|
21
|
+
```
|
22
|
+
|
23
|
+
上記の処理で動きました。
|
24
|
+
|
25
|
+
> Xamarin.Android(C#)でCanvas上にButtonを設置する方法を教えてください。
|
26
|
+
|
27
|
+
が主な質問と思いますが、axmlを以下の様な感じ(位置とかは気にしないでください)でいけました。
|
28
|
+
|
29
|
+
```axml
|
30
|
+
<?xml version="1.0" encoding="utf-8"?>
|
31
|
+
<RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android"
|
32
|
+
p1:minWidth="25px"
|
33
|
+
p1:minHeight="25px"
|
34
|
+
p1:layout_width="fill_parent"
|
35
|
+
p1:layout_height="fill_parent"
|
36
|
+
p1:id="@+id/relativeLayout1">
|
37
|
+
<jpeg2000test.jpeg2000test.View_C
|
38
|
+
p1:layout_width="match_parent"
|
39
|
+
p1:layout_height="match_parent" />
|
40
|
+
<Button
|
41
|
+
p1:layout_marginLeft="200.0dp"
|
42
|
+
p1:layout_marginTop="200.0dp"
|
43
|
+
p1:layout_width="200dp"
|
44
|
+
p1:layout_height="70dp"
|
45
|
+
p1:id="@+id/btnOne"
|
46
|
+
p1:textSize="30dp"
|
47
|
+
p1:text="ボタン"
|
48
|
+
/>
|
49
|
+
</RelativeLayout>
|
50
|
+
```
|
51
|
+
|
52
|
+
CustomViewを記述する方法が、バージョンによってちょっと違うようなので気をつけたほうが良さそうです。
|
53
|
+
[https://forums.xamarin.com/discussion/comment/122750/#Comment_122750](https://forums.xamarin.com/discussion/comment/122750/#Comment_122750)
|
54
|
+
|
55
|
+

|