2015-10-08 21 views
5

Làm thế nào tôi có thể làm cho thanh công cụ như ở bức ảnh này:
Đây là lần đầu tiên nhà nước
enter image description here
Và đây là lần thứ hai nhà nước
enter image description here
tôi sử dụng Thu Thanh công cụ với CalendarView. Tôi sử dụng thư viện này cho CalendarView com.prolificinteractive:material-calendarview:1.0.1 Và đây là mã xml của tôi:Toolbar với lịch

<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> 

Và câu hỏi thứ hai: Làm thế nào tôi có thể mở thanh công cụ duy nhất trên nhấp chuột mà không cần cuộn?

+0

Không nhìn thấy mã, thật khó nói. Các tệp xml của bạn không đủ. –

+0

@metalink Bạn có nhận được giải pháp không? –

+0

Có, tôi đã quyết định sự cố này – metalink

Trả lời

2

Sử dụng CompactCalendarView Thư viện Guy đã tạo điều gì đó Awsome. HopeFully, điều này sẽ giúp bạn.

Các vấn đề liên quan