在FullCalendar上,在月视图中,有没有办法隐藏事件的开始时间?
答案 0 :(得分:41)
只需添加日历选项
即可package com.fit.compaq.fitkit;
import android.content.Context;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
public class pushup extends AppCompatActivity
{
int count;
Sensor proximity;
SensorManager sm;
TextView text;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pushup);
ToggleButton pushupbutton = (ToggleButton) findViewById(R.id.tbutton_pushup);
pushupbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
sm = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
proximity = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
text = (TextView) findViewById(R.id.text_pushup_counter);
final SensorEventListener mySensorEventListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
Toast.makeText(getApplicationContext(), "sensor changed:", Toast.LENGTH_SHORT).show();
text.setText(+event.values[0] + "");
if (event.values[0] < event.sensor.getMaximumRange()) {
count++;
Toast.makeText(getApplicationContext(), "Count = " + count, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
protected void onResume() {
sm.registerListener(this, proximity,
SensorManager.SENSOR_DELAY_NORMAL);
}
protected void onPause() {
sm.unregisterListener(this);
}
};
}
}
);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_pushup, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
答案 1 :(得分:31)
将以下样式添加到您的css
.fc-event-time{
display : none;
}
或版本2 +:
.fc-time{
display : none;
}
答案 2 :(得分:14)
试试这个,它对我有用:
$('#calendar').fullCalendar({
displayEventTime : false
});
这应该隐藏标题事件中的开始时间。
答案 3 :(得分:11)
以下内容仅在月视图中隐藏日期:
.fc-view-month .fc-event-time{
display : none;
}
答案 4 :(得分:7)
另一种方法是添加一个eventRender函数。通过这种方式,您可以选择不渲染时间,并执行其他操作,例如将一些数据附加到事件中。
eventRender: function(event, element) {
element.find('.fc-event-title').append("<br/>" + event.location);
element.find('.fc-event-time').hide();
}
答案 5 :(得分:5)
提醒CSS类名已更改为
.fc-time {
display:none;
}
答案 6 :(得分:4)
要隐藏它们,以下内容应该可以正常工作
$('#calendar').fullCalendar({
displayEventTime : false
});
但如果你(像我一样)试图隐藏特定事件的时间,我发现它非常干净。
只需创建以下CSS类并在事件属性“className”中引用它:
.hideCalendarTime > div > span.fc-time{
display:none;
}
你的活动应该是这样的:
var newEvent = new Object();
newEvent.title = "Something";
newEvent.start = new Date();
newEvent.allDay = false;
newEvent.className = "hideCalendarTime";
答案 7 :(得分:3)
如果您完全想要删除开始时间,可以使用以下代码
$('#calendar-canvas').fullCalendar({
header: {
left: 'today prev,next title',
right: 'agendaDay,agendaWeek,month'
},
firstDay: 1,
eventRender: function(event, element) {
$(element).find(".fc-event-time").remove();
}
});
答案 8 :(得分:2)
我知道你问这个问题已经有三个月了。但是,如果你和我试图做同样的事情,那么其他人可能正在寻找答案。
在fullcalendar.js文件中,注释行1603:
htmlEscape(formatDates(event.start, event.end, view.option('timeFormat'), options)) +
这不是一个修复,充其量只是一个黑客,但它的工作原理。
答案 9 :(得分:2)
根据http://fullcalendar.io/docs/text/timeFormat/,您只需在fullCalendar设置中设置时间格式:
$('#calendar').fullCalendar({
events: [
],
timeFormat: ' '
});
答案 10 :(得分:0)
尽管@Riz在发布时是正确的,但css在最近的版本中发生了变化,现在您需要以下内容。
.fc-day-grid-event .fc-time{
display:none;
}
答案 11 :(得分:0)
.fc-time-grid-event.fc-short .fc-time,.fc-time-grid-event .fc-time{
display: none !important;
}
以上代码将在所有视图中更正它。
下面的代码有一个流程,可以在事件的大视图中显示时间
.fc-time-grid-event.fc-short .fc-time{
display: none !important;
}
请在css中使用此代码隐藏仅限活动的时间。
仅使用
.fc-time{
display: none !important;
}
也会隐藏左侧网格的时间。
答案 12 :(得分:0)
只需从fullCalendar函数中删除allDay: false,