0

J'ai un RecyclerView dans mon activité qui montre 4 cartes différentes de type différent. Une de ces cartes montre une vue personnalisée du calendrier de cette bibliothèque WeekView. Tout s'affiche ok jusqu'à ce que je commence à faire défiler ma vue et la carte de calendrier commence à sortir des limites de l'écran. La vue hebdomadaire personnalisé semble être tiré sur la couche de barre provoquant l'effet ci-dessus montre l'imageAndroid vue personnalisée dans la cellule

Before scroll

After scroll

Comme vous pouvez le voir le Vignettes défile correct mais la vue de la semaine personnalisée va au-dessus de la couche de la barre d'outils.

Dans mon Adapter j'initialiser le WeekView dans mon 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())); 
} 

Et ceci est mon xml pour mon 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

par hasard avez-vous d'éteindre les enfants clip? C'est la seule façon dont je vois normalement quelque chose comme ça. –

Répondre

0

Ajouter ceci à votre vue personnalisée:

android:margin_top="?attr/actionBarSize" 

t sa volonté fera une marge supérieure à la taille de la barre d'action/barre d'outils qui fera le défilement fixé à la taille correcte.

0

J'ai trouvé une solution. Si vous commentez code du format ci-dessus dans le WeekView il fonctionne correctement

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