質問編集履歴

4

修正

2015/11/17 03:02

投稿

teck
teck

スコア27

test CHANGED
File without changes
test CHANGED
@@ -24,6 +24,8 @@
24
24
 
25
25
  ```ここに言語を入力
26
26
 
27
+ <?xml version="1.0" encoding="utf-8"?>
28
+
27
29
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
28
30
 
29
31
  xmlns:tools="http://schemas.android.com/tools"
@@ -34,7 +36,7 @@
34
36
 
35
37
 
36
38
 
37
- <パッケージ名.Activity名
39
+ <example.calendarsample.CalendarView
38
40
 
39
41
  android:id="@+id/Calendar1"
40
42
 
@@ -46,7 +48,7 @@
46
48
 
47
49
  android:layout_marginTop="49dp" >
48
50
 
49
- </パッケージ名.Activity名>
51
+ </example.calendarsample.CalendarView>
50
52
 
51
53
 
52
54
 

3

文の編集

2015/11/17 03:02

投稿

teck
teck

スコア27

test CHANGED
File without changes
test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- 追記
23
+ Activity.xml
24
24
 
25
25
  ```ここに言語を入力
26
26
 

2

文の追加

2015/11/16 23:52

投稿

teck
teck

スコア27

test CHANGED
File without changes
test CHANGED
@@ -53,3 +53,69 @@
53
53
  </RelativeLayout>
54
54
 
55
55
  ```
56
+
57
+
58
+
59
+ MainActivity.class
60
+
61
+ ```ここに言語を入力
62
+
63
+
64
+
65
+ public class MainActivity extends Activity {
66
+
67
+
68
+
69
+ public class CalendarView extends LinearLayout {
70
+
71
+ private static final int WEEK_7 = 7;
72
+
73
+ private static final int MAX_WEEK = 6;
74
+
75
+
76
+
77
+ public CalendarView(Context context, AttributeSet attrs) {
78
+
79
+
80
+
81
+ -----------------------------------------------------------------------------------
82
+
83
+ /** 日付のフォントサイズ */
84
+
85
+ public float dayFontPx;
86
+
87
+ private TextView mTitle; // 年月表示部分
88
+
89
+ private LinearLayout mWeekLayout;
90
+
91
+ private ArrayList<LinearLayout> mWeeks = new ArrayList<LinearLayout>();
92
+
93
+ private Calendar mToday;
94
+
95
+ }
96
+
97
+
98
+
99
+
100
+
101
+ @Override
102
+
103
+ public void onCreate(Bundle savedInstanceState) {
104
+
105
+ super.onCreate(savedInstanceState);
106
+
107
+ setContentView(R.layout.Activity.xml名);
108
+
109
+
110
+
111
+ CalendarView cal = (CalendarView) findViewById(R.id.Calendar1);
112
+
113
+ cal.beginningWeek = Calendar.SUNDAY; // 週の開始曜日を指定
114
+
115
+ cal.init(2012, 9-1); // 2012年9月のカレンダーを表示
116
+
117
+
118
+
119
+ }
120
+
121
+ ```

1

文の追加

2015/11/16 13:56

投稿

teck
teck

スコア27

test CHANGED
File without changes
test CHANGED
@@ -17,3 +17,39 @@
17
17
 
18
18
 
19
19
  [CalendarViewを作成](http://smartphone-zine.com/mobile/custom-component-calendarview%E3%82%92%E4%BD%9C%E6%88%90.html)
20
+
21
+
22
+
23
+ 追記
24
+
25
+ ```ここに言語を入力
26
+
27
+ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
28
+
29
+ xmlns:tools="http://schemas.android.com/tools"
30
+
31
+ android:layout_width="match_parent"
32
+
33
+ android:layout_height="match_parent" >
34
+
35
+
36
+
37
+ <パッケージ名.Activity名
38
+
39
+ android:id="@+id/Calendar1"
40
+
41
+ android:layout_width="260dp"
42
+
43
+ android:layout_height="wrap_content"
44
+
45
+ android:layout_centerHorizontal="true"
46
+
47
+ android:layout_marginTop="49dp" >
48
+
49
+ </パッケージ名.Activity名>
50
+
51
+
52
+
53
+ </RelativeLayout>
54
+
55
+ ```