From 3f403ffb5dd715107598cd19c41d82f0ce6e856d Mon Sep 17 00:00:00 2001 From: necer <619008099@qq.com> Date: Mon, 5 Feb 2018 17:23:10 +0800 Subject: [PATCH] =?UTF-8?q?fragment=20hide=20show=20=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_week.xml | 2 +- app/src/main/res/layout/fragment_1.xml | 5 ++++- .../com/necer/ncalendar/calendar/CalendarPager.java | 10 ++++++++-- .../src/main/java/com/necer/ncalendar/utils/Attrs.java | 4 ++-- .../java/com/necer/ncalendar/view/CalendarView.java | 4 ++-- ncalendar/src/main/res/values/attrs.xml | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/layout/activity_week.xml b/app/src/main/res/layout/activity_week.xml index 071f0a7a..ccf75453 100644 --- a/app/src/main/res/layout/activity_week.xml +++ b/app/src/main/res/layout/activity_week.xml @@ -15,6 +15,6 @@ android:id="@+id/weekCalendar" android:layout_width="match_parent" android:layout_height="50dp" - android:visibility="gone"> + android:visibility="visible"> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_1.xml b/app/src/main/res/layout/fragment_1.xml index 93acacdb..1dc9585c 100644 --- a/app/src/main/res/layout/fragment_1.xml +++ b/app/src/main/res/layout/fragment_1.xml @@ -1,5 +1,6 @@ @@ -14,7 +15,9 @@ + android:layout_height="300dp" + app:selectCircleRadius ="20dp"/> + diff --git a/ncalendar/src/main/java/com/necer/ncalendar/calendar/CalendarPager.java b/ncalendar/src/main/java/com/necer/ncalendar/calendar/CalendarPager.java index 296f2c87..02ef969a 100644 --- a/ncalendar/src/main/java/com/necer/ncalendar/calendar/CalendarPager.java +++ b/ncalendar/src/main/java/com/necer/ncalendar/calendar/CalendarPager.java @@ -10,6 +10,7 @@ import com.necer.ncalendar.R; import com.necer.ncalendar.adapter.CalendarAdapter; import com.necer.ncalendar.utils.Attrs; +import com.necer.ncalendar.utils.MyLog; import com.necer.ncalendar.utils.Utils; import com.necer.ncalendar.view.CalendarView; @@ -55,13 +56,18 @@ public CalendarPager(Context context, AttributeSet attrs) { Attrs.hintColor = ta.getColor(R.styleable.NCalendar_hintColor, getResources().getColor(R.color.hintColor)); Attrs.solarTextSize = ta.getDimension(R.styleable.NCalendar_solarTextSize, Utils.sp2px(context, 18)); Attrs.lunarTextSize = ta.getDimension(R.styleable.NCalendar_lunarTextSize, Utils.sp2px(context, 10)); - Attrs.selectCircleRadius = ta.getInt(R.styleable.NCalendar_selectCircleRadius, (int) Utils.dp2px(context, 20)); + Attrs.selectCircleRadius = ta.getDimension(R.styleable.NCalendar_selectCircleRadius, Utils.dp2px(context, 20)); + + + MyLog.d("selectCircleRadius::" + Attrs.selectCircleRadius); + + Attrs.isShowLunar = ta.getBoolean(R.styleable.NCalendar_isShowLunar, true); Attrs.pointSize = ta.getDimension(R.styleable.NCalendar_pointSize, (int) Utils.dp2px(context, 2)); Attrs.pointColor = ta.getColor(R.styleable.NCalendar_pointColor, getResources().getColor(R.color.pointColor)); Attrs.hollowCircleColor = ta.getColor(R.styleable.NCalendar_hollowCircleColor, Color.WHITE); - Attrs.hollowCircleStroke = ta.getInt(R.styleable.NCalendar_hollowCircleStroke, (int) Utils.dp2px(context, 1)); + Attrs.hollowCircleStroke = ta.getDimension(R.styleable.NCalendar_hollowCircleStroke, Utils.dp2px(context, 1)); Attrs.monthCalendarHeight = (int) ta.getDimension(R.styleable.NCalendar_calendarHeight, Utils.dp2px(context, 300)); diff --git a/ncalendar/src/main/java/com/necer/ncalendar/utils/Attrs.java b/ncalendar/src/main/java/com/necer/ncalendar/utils/Attrs.java index 9dbe12e4..4fac42c1 100644 --- a/ncalendar/src/main/java/com/necer/ncalendar/utils/Attrs.java +++ b/ncalendar/src/main/java/com/necer/ncalendar/utils/Attrs.java @@ -11,14 +11,14 @@ public class Attrs { public static int selectCircleColor; public static float solarTextSize ; public static float lunarTextSize; - public static int selectCircleRadius ; + public static float selectCircleRadius ; public static boolean isShowLunar ; public static float pointSize; public static int pointColor; public static int hollowCircleColor; - public static int hollowCircleStroke; + public static float hollowCircleStroke; public static int firstDayOfWeek; public static int defaultCalendar; diff --git a/ncalendar/src/main/java/com/necer/ncalendar/view/CalendarView.java b/ncalendar/src/main/java/com/necer/ncalendar/view/CalendarView.java index cfaab6e4..18657feb 100644 --- a/ncalendar/src/main/java/com/necer/ncalendar/view/CalendarView.java +++ b/ncalendar/src/main/java/com/necer/ncalendar/view/CalendarView.java @@ -33,7 +33,7 @@ public abstract class CalendarView extends View { protected float mLunarTextSize; protected Paint mSorlarPaint; protected Paint mLunarPaint; - protected int mSelectCircleRadius;//选中圆的半径 + protected float mSelectCircleRadius;//选中圆的半径 protected int mSelectCircleColor;//选中圆的颜色 protected boolean isShowLunar;//是否显示农历 @@ -45,7 +45,7 @@ public abstract class CalendarView extends View { protected float mPointSize;//圆点大小 protected int mHollowCircleColor;//空心圆颜色 - protected int mHollowCircleStroke;//空心圆粗细 + protected float mHollowCircleStroke;//空心圆粗细 protected boolean isShowHoliday;//是否显示节假日 protected List holidayList; diff --git a/ncalendar/src/main/res/values/attrs.xml b/ncalendar/src/main/res/values/attrs.xml index 7e260e8d..d109b01b 100644 --- a/ncalendar/src/main/res/values/attrs.xml +++ b/ncalendar/src/main/res/values/attrs.xml @@ -7,13 +7,13 @@ - + - +