android - 如何使用 com.prolificinteractive :material-calendarview's CalendarView? 创建某个工具栏

标签 android calendar material-design toolbar

我怎样才能像这张照片一样制作工具栏:
这是第一个状态
enter image description here
这是第二种状态
enter image description here
我将折叠工具栏与 CalendarView 一起使用。我将此库用于 CalendarView com.prolificinteractive:material-calendarview:1.0.1 这是我的 xml 代码:

<android.support.design.widget.CoordinatorLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/rootLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:id="@+id/appbar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingToolbarLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <com.prolificinteractive.materialcalendarview.MaterialCalendarView
                android:id="@+id/calendarView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:mcv_showOtherDates="all"
                app:mcv_selectionColor="#00F">

            </com.prolificinteractive.materialcalendarview.MaterialCalendarView>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                android:background="@color/primary_color"
                android:titleTextColor="@color/text_color"
                android:minHeight="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/nickname_profile"
                android:text="@string/nickname"
                android:textColor="@color/text_color"
                android:textSize="24sp"
                android:layout_gravity="bottom|center"
                android:layout_marginBottom="20dp"
                android:layout_marginRight="40dp"
                />
            </android.support.v7.widget.Toolbar>
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/general_fragment"
                app:layout_behavior="@string/appbar_scrolling_view_behavior">

            </FrameLayout>
</android.support.design.widget.CoordinatorLayout>

第二个问题:如何在不滚动的情况下只点击打开工具栏?

最佳答案

使用 CompactCalendarView图书馆本Guy做了一些很棒的东西。 HopeFully,这对你有帮助。

关于android - 如何使用 com.prolificinteractive :material-calendarview's CalendarView? 创建某个工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33024018/

相关文章:

java - 如何在 ListView 中通知数据集正确更改

Android Realm for 循环 - RealmResults 在循环期间被删除

android - 应用程序链接或深层链接

Java 日历 - getMinimalDaysInFirstWeek 但不是来自 get 实例

javascript - 如何创建 vuetify 工具栏链接下拉菜单?

android - 如何单击工具栏后面的 View ?

java - Android:使用findViewById时需要引用 View ?

java - 在一行中设置日期

iphone - 如何在NSCalender中设置事件?

android - 如何更改 Material Design ActionBar 的文本?