1

I am creating an app where I want to show an custom calendar day view like below imagecustom calendar day view

I have tried to search google and found one link Android-Week-View But it's not helpful.

Phiter
  • 14,570
  • 14
  • 50
  • 84
Sritam Jagadev
  • 955
  • 4
  • 18
  • 46

2 Answers2

1

If you want to do a weekly calendar like shown in the picture. You could just put a LinearLayout orientaion horizontal with 7 LinearLayout with a vertical orientation inside. If the problem is how to get the day you can check here: How the get the current day name using particular date in android? or here Get day of the week from GregorianCalendar If you want the weird line like we can at the sat 16 you will have to a background drawable, I don't know if it's possible to do that in xml. But sure you can draw it on the ondraw method so you could make a custom View. Then if you will want to put your custom View as background you will have to use a RelativeLayout:

<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"
tools:context="info.androidhive.materialtabs.fragments.OneFragment"
android:weightSum="7">
<RelativeLayout android:layout_width="0dp"
    android:layout_height="70dp"
    android:layout_weight="1">
    <View android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/holo_red_light"></View>
    <TextView
        android:id="@+id/one"
        android:layout_width="match_parent"
        android:layout_height="35dp"
        android:text="day"
        android:gravity="center"/>
    <TextView
        android:gravity="center"
        android:text="num"
        android:layout_below="@id/one"
    android:layout_width="match_parent"
    android:layout_height="35dp" />
</RelativeLayout>
</LinearLayout>

Something like that, put the Relative 6 times more.

enter image description here

Community
  • 1
  • 1
king
  • 507
  • 1
  • 4
  • 17
  • yes i can do that but i want it to be recycled and horizontally scrollable, means if i am scrolling this calendar from left to right OR right to left then corresponding days and dates needs to be updated accordingly. – Sritam Jagadev Feb 20 '16 at 14:08
  • ok so I think you should watch this post:http://stackoverflow.com/questions/28460300/how-to-build-a-horizontal-listview-with-recyclerview – king Feb 20 '16 at 14:20
0

This can be done without using any lib. Just put a recyclerview and add array of dates to it. I have done it for my project in the same way and same design. But it will take some time and will have confusion as you got to play with the calendar class here and get the dates as per your requirement.