2016-08-23 5 views
2

年12月のカレンダーをAndroidで作成iosです。Androidの年間カレンダーのように

この写真のようなものです。年月日は です。

私は2リストビューと1グリッドビューでそれを行いますが、私は年の項目の間に遅れがあります。

50年間.12ヶ月テキストあり。


enter image description here

+1

ちょうどそれをしてください。何が問題なの? – Vyacheslav

+0

私は年の項目の間にラグがあります。私は重いプロセスを持っています。 –

+0

https://github.com/square/android-times-square –

答えて

0

この例を参照してください。..

https://github.com/ik024/CalendarLibrary

enter image description here

を(このショーの2列、あなたの要件を満たすよりも、2つの列を設定する方法このコードをチェックしてください) xmlファイルに次を追加します。

<com.github.ik024.calendar_lib.YearView 
    android:id="@+id/calendar_year_view" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true"/> 

は、あなたの活動にYearViewClickListenerを実装し、よりYearViewDemo.javaファイルを参照してください

public class MonthViewDemo extends AppCompatActivity implements YearViewClickListeners{ 


@Override 
public void dateClicked(int year, int month, int day) { 
    Toast.makeText(this, "year: "+year+";\nmonth: "+month+";\nday: "+day, Toast.LENGTH_LONG).show(); 
    //TODO: Perform your actions based on year or month or day clicked 
    } 


} 

を。

カスタマイズが

次の属性をカスタマイズすることができます:あなたは

を変更する必要が3列の場合

<attr name="currentDayTextColorYV" format="color"/> 
<attr name="monthNameTextColorYV" format="color"/> 
<attr name="daysOfMonthTextColorYV" format="color"/> 
<attr name="daysOfWeekTextColorYV" format="color"/> 
<attr name="eventDayBackgroundColorYV" format="color"/> 
<attr name="eventDayTextColorYV" format="color"/> 
<attr name="calendarBackgroundColorYV" format="color" /> 
<attr name="monthNameBackgroundColorYV" format="color" /> 
<attr name="displayYearTextColorYV" format="color" /> 
<attr name="headerBackgroundColorYV" format="color" /> 
<attr name="prevButtonBackgroundResourceYV" format="reference" /> 
<attr name="nextButtonBackgroundResourceYV" format="reference" /> 

はcalendarlibに行く/レイアウト/ yearView.xml

は、これを行います。..あなたに応じてすべての変更を行います。

<LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:weightSum="1"> 

      <com.github.ik024.calendar_lib.custom.MonthView 
       android:id="@+id/mv_year_view_jan" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.33" /> 

      <com.github.ik024.calendar_lib.custom.MonthView 
       android:id="@+id/mv_year_view_feb" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.33" /> 

      <com.github.ik024.calendar_lib.custom.MonthView 
       android:id="@+id/mv_year_view_march" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.33" /> 
     </LinearLayout> 

または他のすべて3つ

+0

前にこのgithubをチェックしましたが、。この例では各画面が1年しかありません。わずか12か月ごとに表示されます。スクロールしない、IOSのように毎年ではない –

0

https://github.com/wasabeef/awesome-android-ui/blob/master/pages/Calendar.md

これらのライブラリは、あなたwant.Youがあなたの必要性に応じて、これらのライブラリの一部を変更してみてください何を達成するためにあなたを助けるかもしれません。 YearViewについては

+0

いいえ、適していません。 –

+0

このフル出力を1画面に表示したいですか? –

+0

ええ、月の3桁、年は3ヵ月です。 –

関連する問題