-
Notifications
You must be signed in to change notification settings - Fork 317
详细用法
yannecer edited this page Jul 4, 2024
·
2 revisions
1、本项目包含三种日历形态,月日历、周日历和折叠日历,每种都可以单独使用
2、如果业务需要多个View,可以使用ViewGroup布局包裹,NCalendar只能有一个直接子View
<com.necer.calendar.NCalendar
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultCalendar="month"/>
<com.necer.calendar.NCalendar
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultCalendar="week"/>
<com.necer.calendar.NCalendar
android:id="@+id/miui10Calendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.necer.calendar.Miui9Calendar>
或
<com.necer.calendar.NCalendar
android:id="@+id/miui10Calendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<androidx.core.widget.NestedScrollView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
...
</androidx.core.widget.NestedScrollView
</com.necer.calendar.Miui9Calendar>
或
日历中有多个View
<com.necer.calendar.NCalendar
android:id="@+id/miui10Calendar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="test" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@mipmap/ic_launcher" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#666666"
android:gravity="center"
android:text="测试添加view"
android:textColor="#ffffff" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
</com.necer.calendar.NCalendar>
日历自定义属性参考 属性介绍页