1
I’m working on a project where I need to put one CalendarView
next to a Toolbar
. The problem is that the Toolbar
gets a shadow on the bottom, where I’d like you to join the CalendarView
. I tried to look into it, but I don’t know what the ideal search terms would be and I ended up finding nothing.
Currently, that’s how the layout is. That’s my main XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".PontoDiaActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:padding="0dp"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment"
android:name="com.renanlazarotto.ponto.fragments.PontoDiaActivityFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:layout="@layout/fragment_ponto_dia" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
And this is the Fragment that contains Calendarview:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".PontoDiaActivityFragment">
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/red_500" />
<TextView
android:id="@+id/selected_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
</LinearLayout>
Note that it is still a simple project without many elements. I even researched a little about elevation (Elevation) and clipping, but I didn’t get any results.
Someone can give me a light?
Thank you very much, solved my problem!
– Renan Lazarotto
Wakim, ask me one more question: is it possible to remove (or change color) the line and commands where "October 2015" is written? I managed to change everything but these two items.
– Renan Lazarotto
@Renanlazarotto, to stylize the
CalendarView
take a look at the parameters ofstyle
which it accepts: http://developer.android.com/reference/android/widget/CalendarView.html. If no help, it has to go to an external lib, which is closer than you want it to be..– Wakim
Thanks again, @Wakim. I’ll have to find another one anyway :/
– Renan Lazarotto