AndroidStudioを使いカレンダーを作成しています。
カレンダーを表示した際に日付のところに丸、三角、ばつを表示させたいです。
イメージではプロ野球スピリッツのアプリの試合日程のような感じです。
MainActivity.kt import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.CalendarView import android.widget.Toast class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val calendarView = findViewById<CalendarView>(R.id.calendar) // 日付変更イベントを追加 calendarView.setOnDateChangeListener { view, year, month, dayOfMonth -> val date = "$year/$month/$dayOfMonth" Toast.makeText(this, date, Toast.LENGTH_SHORT).show() } } activity.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <CalendarView android:id="@+id/calendar" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:ignore="MissingConstraints" /> </androidx.constraintlayout.widget.ConstraintLayout>
やりたいことだけを書かれても恐らく回答は付き難いかと思います。
なぜならそれは「作ってください」ということになりかねないからです。
どのように考えてどのようなコードを書きどのような結果になったのか、どこまで試行錯誤してどこで躓いているのか等を追記されては如何でしょうか。

あなたの回答
tips
プレビュー