zoukankan      html  css  js  c++  java
  • 安卓学习第27课——calendarView

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="选择您的生日" />
    
        <CalendarView
            android:id="@+id/calendarView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:firstDayOfWeek="3"
            android:shownWeekCount="4"
            android:selectedWeekBackgroundColor="#aff"
            android:weekSeparatorLineColor="#ff0"
            android:unfocusedMonthDateColor="#f9f" />
    
    </LinearLayout>
    package com.example.canlendarview;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.CalendarView;
    import android.widget.CalendarView.OnDateChangeListener;
    import android.widget.Toast;
    
    public class MainActivity extends Activity {
        CalendarView cv;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            cv=(CalendarView) findViewById(R.id.calendarView);
            cv.setOnDateChangeListener(new OnDateChangeListener(){
    
                @Override
                public void onSelectedDayChange(CalendarView view, int year,
                        int month, int dayOfMonth) {
                    Toast.makeText(MainActivity.this, "你的生日是"+year+"年"+month+"月"+dayOfMonth+"日", Toast.LENGTH_SHORT).show();
                }
                }
            );
        }
    
        
    }
  • 相关阅读:
    form表单提交target属性使用
    window.showModalDialog
    mybaits中date类型显示时分秒(orcle数据库)
    mybatis中in查询
    偷懒的inline-block解决方法
    10. python单元测试(一)
    9. Request & 爬虫
    8. 类与对象
    7. python异常处理&异常基类学习
    6. IO及文件操作
  • 原文地址:https://www.cnblogs.com/Yvettey-me/p/3969778.html
Copyright © 2011-2022 走看看