I am going to create a new appliction that will use a calendar. Do I need to use a third-party calendar, or does Android provide an API to make calendars?
There is no Calendar component that ships with Android. Your best bet is to create one using a GridView that you will bind to an adapter containing all the days of a given month.
Android does have a CalendarView from 3.0 but there is no setAdapter(). You might want to either want to use a gridView and set the # of columns to 7 (note there might me a space left to the right to which you could set the padding to -1/-2). Otherwise the best is to use a ScrollView and build the grid yourself.
Related
i don't know how to customize a calendar view to be the same as the picture for my application. Here is my example picture.
In the past, I had the same problem so I have created a Kotlin library which solves this problem. You can create a calendar with your custom UI and use selection features with few lines of code. You can find the repository here and here is an article about my sample app.
Additionally, there is a similar library for Java here.
Yes u can define a custom calender view like that. Here is my suggestion:
ListView/ReceyclerView
Calendar class
Easy way is make user pick month/year first, your list only display day.
I am using a calendar view inside a dialog fragment .I am getting the one as shown below. I am using the default calendarview provided.
But instead i want to get a calendar view as this one , which is shown by default in xml when i add:
I have tried changing the style to Widget.DeviceDefault.Light.CalendarView , Widget.Material.CalendarView but with same effect.
If you're using prolificinteractive materialcalendarview library, to change header style for year and month.
check my answer here:
How can I change Android MaterialCalendarView month color?
I don't know How to create Custom Calendar but you might check this GitHub library.You may succeed in creating the one, you are asking for with just little customization
https://github.com/prolificinteractive/material-calendarview
And also Refer to this Useful Stackoverflow post from which you will definitely be able to implement a CalenderView as you wanted.
Custom Android calendarView
At first I didn't understand why CalendarView component looks different in Android Studio and on my phone, but then I found this post https://stackoverflow.com/a/45368436/11052714
So the reason you are seeing this on your phone is because of API level. In the post I mentioned above, however I think wrong API level is mentioned, because I have the old calendar view with Android version 5.0.2 aka API level 21. It means that still in API level 21 old Calendar View visual look is used.
I want to display a CalendarView and then change backgound of certain blocks (of dates) red and certain blocks green. Now, I don't think I can do that in default CalendarView.
So, I started googling about how to create a custom CalendarView and I came to know that creating a custom CalendarView is impossible. We have to use a GridView.
So, I just wanted to know that is that really true and if it is not then how should I go about making a custom CalendarView
There is a library available now known as ZCustomCalendar which allows you to define individual custom views for various types of dates.
I need custom calendar like CKCalendar in iOS - https://github.com/jaykz52/CKCalendar
In CKCalendar iOS I can set colors of days, can disable dates for touch.
Is there anything similar for Android?
Check out Times Square by Square. It might not have the exact customizations you want but it's customizable enough so that you can modify to suit your needs.
I'm building an App for Android that already exists for iOS. On iOS, we really like to use the listview grouped style to show details and forms. It is really useful to show details of objects that we don't know how much properties they have before loading it.
I know that Android doesn't have a similar tableview style. And I don't want to use a custom library to recreate it, because I don't want to force an iOS like interface to my Android's users.
But how would you create a consistent Android interface that show similar information? Do you have example for me?
First of all, your instinct to not force iOS style UI onto Android users is correct and I respect you for it.
Android's ListView is roughly the equivalent of iOS's UITableView. There are important differences. For instance, you should never use a ListView inside another scrollable container. If a ListView is in a particular layout, it should (usually) be the only scrollable component. If you want multiple ListViews in a layout, you probably don't want ListViews at all. You should instead use (vertical) LinearLayouts and add the items in order.
Cyril Mottier writes excellent posts on implementing custom behavior for Android's ListView.
If you want to display data in a list then you can use the ListView. Here is a great article about how to use it.