0

다른 활동의 4 가지 카드를 보여주는 나의 활동 안에 RecyclerView이 있습니다. 해당 카드 중 하나가이 라이브러리 WeekView에서 캘린더 사용자 정의보기를 보여줍니다. 내보기를 스크롤하기 시작하고 캘린더 카드가 화면 경계를 벗어날 때까지 모든 것이 괜찮습니다. 사용자 정의 주보기는 cardview 올바른 스크롤되지만 사용자 정의 주보기 것입니다 볼 수 있듯이 이미지셀의 Android 사용자 정의보기

Before scroll

After scroll

에 표시된 위의 효과를 일으키는 도구 모음 층 상에 그려 질 것 같다 툴바 레이어 위. 내 Adapter에서

내가 내 ViewHolder

calendarView = (WeekView) itemView.findViewById(R.id.todayView); 
if (calendarView != null) { 
      initializeCalendarView(calendarView); 
     } 


private void initializeCalendarView(WeekView mWeekView) { 
    mWeekView.setOnEventClickListener(this); 
    mWeekView.setMonthChangeListener(this); 
    mWeekView.setEventLongPressListener(this); 
    mWeekView.setEmptyViewLongPressListener(this); 
    setupDateTimeInterpreter(false, mWeekView); 
    mWeekView.goToToday(); 

    mWeekView.setColumnGap((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, context.getResources().getDisplayMetrics())); 
    mWeekView.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, context.getResources().getDisplayMetrics())); 
    mWeekView.setEventTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, context.getResources().getDisplayMetrics())); 
} 

에서 WeekView를 초기화 그리고 이것은 내 xml을 내 CardView

<android.support.v7.widget.CardView 
    android:id="@+id/doctorDashboardCalendar" 
    android:layout_width="match_parent" 
    android:layout_height="800dp" 
    android:layout_margin="@dimen/margin10" 
    app:cardCornerRadius="3dp"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:layout_gravity="center_vertical" 
      android:gravity="center_vertical" 
      android:background="#e0e0e0"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/notes_icon_dark" 
       android:layout_margin="10dp"/> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:textSize="@dimen/text18" 
       android:fontFamily="@string/font_name_2" 
       android:text="Calendar"/> 

     </LinearLayout> 

     <*************************.WeekView 
      android:id="@+id/todayView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:clipToPadding="true" 
      app:eventTextColor="@android:color/white" 
      app:textSize="12sp" 
      app:hourHeight="30dp" 
      app:headerColumnPadding="4dp" 
      app:headerColumnTextColor="@color/toolbar_text" 
      app:headerRowPadding="6dp" 
      app:columnGap="4dp" 
      app:noOfVisibleDays="1" 
      app:headerRowBackgroundColor="@color/toolbar" 
      app:dayBackgroundColor="#05000000" 
      app:todayBackgroundColor="@color/white" 
      app:headerColumnBackground="#ffffffff" 
      app:todayHeaderTextColor="@color/accent" 
      app:showNowLine="true" 
      app:nowLineColor="@color/colorAccent" 
      app:enableScrolling="false"/> 

    </LinearLayout> 

</android.support.v7.widget.CardView> 
+0

언제든지 클립 어린이를 껐습니까? 그게 내가 평범하게 볼 수있는 유일한 방법입니다. –

답변

0

사용자 정의보기에이 추가 :

android:margin_top="?attr/actionBarSize" 

티 스크롤바가 올바른 크기로 고정되도록하는 작업 표시 줄/도구 모음의 크기에 여백을 둡니다.

0

해결책을 찾았습니다. WeekView에서 위 형식의 코드에 주석을 달면 올바르게 작동합니다.

canvas.clipRect(left, top, width, heigh, Region.Op.REPLACE);