Comments (13)
(⊙o⊙)哦已经 解决了,这个控件很不错。收藏了哈哈
from supercalendar.
at calendar.oa.com.myapplication.MainActivity.initCalendarView(MainActivity.java:114)
把你的MainActivity代码截个图看一下吧
from supercalendar.
from supercalendar.
麻烦再把CustomDayView的全部代码发一下吧
from supercalendar.
package calendar.oa.com.myapplication;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.ldf.calendar.Utils;
import com.ldf.calendar.component.State;
import com.ldf.calendar.interf.IDayRenderer;
import com.ldf.calendar.model.CalendarDate;
import com.ldf.calendar.view.DayView;
/**
- Created by ldf on 17/6/26.
*/
public class CustomDayView extends DayView {
private TextView dateTv;
private ImageView marker;
private View selectedBackground;
private View todayBackground;
private final CalendarDate today = new CalendarDate();
/**
* Constructor. Sets up the MarkerView with a custom layout resource.
*
* @param context
* @param layoutResource the layout resource to use for the MarkerView
*/
public CustomDayView(Context context, int layoutResource) {
super(context, layoutResource);
final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View contentView = inflater.inflate(R.layout.custom_day,null);
dateTv = (TextView) contentView.findViewById(R.id.date);
marker = (ImageView) contentView.findViewById(R.id.maker);
selectedBackground = contentView.findViewById(R.id.selected_background);
todayBackground = contentView.findViewById(R.id.today_background);
}
@Override
public void refreshContent() {
renderToday(day.getDate());
renderSelect(day.getState());
renderMarker(day.getDate(), day.getState());
super.refreshContent();
}
private void renderMarker(CalendarDate date, State state) {
if(Utils.loadMarkData().containsKey(date.toString())) {
if(state == State.SELECT || date.toString().equals(today.toString())) {
marker.setVisibility(GONE);
} else {
marker.setVisibility(VISIBLE);
if(Utils.loadMarkData().get(date.toString()).equals("0") ){
marker.setEnabled(true);
} else {
marker.setEnabled(false);
}
}
} else {
marker.setVisibility(GONE);
}
}
private void renderSelect(State state) {
if (state == State.SELECT) {
selectedBackground.setVisibility(VISIBLE);
dateTv.setTextColor(Color.WHITE);
} else if(state == State.NEXT_MONTH || state == State.PAST_MONTH) {
selectedBackground.setVisibility(GONE);
dateTv.setTextColor(Color.parseColor("#d5d5d5"));
} else {
selectedBackground.setVisibility(GONE);
dateTv.setTextColor(Color.parseColor("#111111"));
}
}
private void renderToday(CalendarDate date) {
if(date != null) {
if(date.equals(today)) {
dateTv.setText("今");
todayBackground.setVisibility(VISIBLE);
} else {
dateTv.setText(date.day + "");
todayBackground.setVisibility(GONE);
}
}
}
@Override
public IDayRenderer copy() {
return new CustomDayView(context , layoutResource);
}
}
from supercalendar.
嗨 我发现 CustomDayView一直获取的控件就是null ,但是 我用了 很多方法 还是不行,有更好的建议嘛?
from supercalendar.
你把你的项目包发过来吧 这么描述我也没法改 QQ 2286767746
from supercalendar.
同上, CustomDayView customDayView = new CustomDayView(context , R.layout.custom_day);也是返回null
from supercalendar.
我也遇到了这个问题,三星note2,4.3会出这个问题,7.1.1以及8.0不会出现这个问题。
from supercalendar.
我也遇到了这个问题,4.3会出这个问题,5.1,7.1.1以及8.0不会出现这个问题。
from supercalendar.
楼上怎么解决的
from supercalendar.
from supercalendar.
谢谢,解决了~。貌似是RelativeLayout的一个bug,系统低于4.4.4都会有问题,改为继承LinearLayout就OK了
from supercalendar.
Related Issues (20)
- 那个效果图中的下拉按钮怎么加上去啊
- calendarViewAdapter.notifyDataSetChanged()为刷新view 手动触摸触发setPrimaryItem时 触发视图刷新 HOT 1
- calendarViewAdapter.notifyDataSetChanged()为刷新view 手动触摸触发setPrimaryItem时 触发视图刷新
- 点击灰色区间出现日期换乱
- 如何设置活动日期,日期下面那个黄色的圆点
- 怎么监听到向上滑变成一行日期的事件
- 解决点击日期错乱问题 !!!!!!!!!!! HOT 2
- 怎么更改只显示当前月的日期,就像钉钉考勤日历那样,
- 怎么添加上下滑动的那个图片啊 HOT 1
- 麻烦老大把添加上下滑的图片那部分代码发出来一下,谢谢了
- 效果图挂了 能更新一下图片吗
- 如何取消今天的默认选中状态 HOT 1
- java.lang.IllegalArgumentException:pointerIndex out of range
- 配合SmartRefreshLayout
- 如何设置日期不可选中
- setMarkData标记的默认颜色能更改吗?
- 关于设置默认周显示 HOT 1
- 如何设置以日为单位进行滑动
- 滑动错乱
- 你好,请问下,我想在日历下面放一个向上和向下折叠的图标,可以提供一个思路吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supercalendar.