This is a migrated thread and some comments may be shown as answers.

Changing Display Modes leaves blank space below Calendar

6 Answers 143 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sal
Top achievements
Rank 1
Sal asked on 03 Mar 2015, 12:18 AM
So I have my view setup with 2 Linear Layouts, the top one contains the CalendarView and the bottom one contains a ListView that will display events for a selected date and one of the features that we need to be able to achieve is switch the CalendarView from a Month View to a Week View. This part is pretty easy to do, I just use the changeDisplayMode method when the button is clicked to switch between the two but one thing that I noticed is that the Week view has a large space below it that doesn't resize (looks like it leaves enough room to transition back to Month or Year Views). Is there any way around that so when I switch to the Week View the Calendar's height will only take up enough space for the Week View and my ListView can then take up the rest of the space to show more items? 

Also another thing I noticed is that right after I dropped the CalendarView into my project I keep getting a warning that the style "calendarStyle" wasn't found in my current theme, but I can't find anything in the documentation on what I need to add to the theme to make the warning go away. Thanks. 

6 Answers, 1 is accepted

Sort by
0
Antony Jekov
Telerik team
answered on 04 Mar 2015, 08:32 AM
Hello Sal,

Thank you for contacting the Android team.

I would suggest you use a single LinearLayout for containing the calendar and the ListView. However the size of the calendar can be customized for the switch between month and week display modes by using:
calendarView.setInOriginalSizeForAllModes(false);
This will cause the calendar to shrink and leave space for the list view.

About your other question - if you are using eclipse, please make sure to include the resources of the calendar as described in the documentation. The calendarStyle is pointing to the DefaultCalendarStyle.

Thank you for your time and all best!

Regards,
Antony Jekov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sal
Top achievements
Rank 1
answered on 04 Mar 2015, 05:38 PM
Thanks Antony, but it still doesn't seem to work correctly even with the adjustment. I think it's partially due to me using weights for each item (since I want the calendar to only take up half the screen in Month view and then less when in Week View). Here's how my XML file looks 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
 
 
        <com.telerik.widget.calendar.RadCalendarView
            android:id="@+id/frag_calendar"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:weekNumberDisplayMode="Inline"/>
 
 
        <ListView
            android:id="@+id/calendar_list_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:fontFamily="sans-serif-regular" />
 
 
</LinearLayout>

And here's the methods that I have hooked up to buttons in the action bar for switching between the two view modes 

public static void MonthViewButtonPressed() {
        if (calendarView.getDisplayMode() == CalendarDisplayMode.Week) {
            //set the display mode to month view
            calendarView.setInOriginalSizeForAllModes(false);
            calendarView.changeDisplayMode(CalendarDisplayMode.Month, true);
        }
    }
 
    public static void WeekViewButtonPressed() {
        if (calendarView.getDisplayMode() == CalendarDisplayMode.Month) {
            //set display mode to week view
            calendarView.setInOriginalSizeForAllModes(false);
            calendarView.changeDisplayMode(CalendarDisplayMode.Week, true);
            calendarView.setDisplayDate(selectedDate.getMillis());
        }
    }



For the second issue, I'm using Android Studio and even though the setup directions stated to add the AAR files to the lib folder and add the flatDir to the gradle file I kept getting an error about not being able to load the file so instead I used the import method to create a new model from the AAR files (so I don't know if that comes into play with the missing theme or not). 
0
Sal
Top achievements
Rank 1
answered on 04 Mar 2015, 09:02 PM
I decided to switch back to using LinearLayouts as containers for each views and then I added a few lines to update the weight of each container in the two methods and now it seems to work the way I wanted it to. 

The only thing I still have an issue with is the missing calendarStyle theme setup, and I tried setting up a new project which did allow me to add the references to the AAR files as the instructions say but I still get the missing style message so it seems like there's something else that's missing in the setup instructions. Also one more thing that I noticed is every time I load the view that has the CalendarView I get a message in the log that says :  E/Common﹕ Could not load licensing class. Again I'm not sure if this is due to how I added the AAR files to my existing project or not, and it doesn't cause any issues with the actual calendar when using it but just wanted to see if that is an actual problem. 
0
Antony Jekov
Telerik team
answered on 05 Mar 2015, 09:45 AM
Hello Sal,

I am now aware of the problem. The calendar is not showing in the preview window as expected and there is a problem with the calendarStyle not being found.

The issue is logged and will be addressed. Thank you for your valuable feedback! I will proceed and close this ticket as resolved. Please feel free to reopen it or open a new one at any time.

Regards,
Antony Jekov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sal
Top achievements
Rank 1
answered on 07 Jul 2016, 03:29 PM
Was this ever fixed in any of the releases since this was posted? I'm working on a new project and using the Calendar I noticed that in the Preview window I'm still getting the Rendering Exception due to the 'calendarStyle' not being found in the current theme. Is there something other than the AAR files I need to copy in order to clear this? I tried looking on the sample project to see if there's any other references that I don't have but didn't see anything out of the ordinary. Right now it comes up right when I add a RadCalendarView to my layout. 
0
Todor
Telerik team
answered on 08 Jul 2016, 08:34 AM
Hi Sal,

Thank you for getting back to us.

The issue with the missing calendarStyle will be cleared with our next version coming in about 2 months.

Regards,
Todor
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Sal
Top achievements
Rank 1
Answers by
Antony Jekov
Telerik team
Sal
Top achievements
Rank 1
Todor
Telerik team
Share this question
or