我正在创建一个带有月视图的自定义日历组件,其中每天都是一个专门的组件。当用户将手指放在一天并在屏幕上移动时,我想在每个触摸的日期组件中执行某些操作。换句话说,我需要来自标准反应的adresses_idadress
事件。
这是我尝试过的:
我已将adresses
,document.body.onload = addElement;
function addElement() {
var schema = [{
"queestion": "Name",
"type": "128",
"attrs": [{
"attr": {
"name": "class",
"value": "nofilling2 engword"
}
},
{
"attr": {
"name": "id",
"value": "name"
}
},
{
"attr": {
"name": "type",
"value": "text"
}
},
{
"attr": {
"name": "placeholder",
"value": "Name"
}
},
{
"attr": {
"name": "name",
"value": "_root.passengerinfo__1.passengerinfo.fullname.firstname"
}
}
]
},
{
"queestion": "Family",
"type": "128",
"attrs": [{
"attr": {
"name": "class",
"value": "nofilling2 engword"
}
},
{
"attr": {
"name": "id",
"value": "family"
}
},
{
"attr": {
"name": "type",
"value": "text"
}
},
{
"attr": {
"name": "placeholder",
"value": "Family"
}
},
{
"attr": {
"name": "name",
"value": "_root.passengerinfo__1.passengerinfo.fullname.lastname"
}
}
]
}
]
for (var i = 0; i < schema.length; i++) {
var type = schema[i].type;
if (type == 128) {
var titleinput = schema[i].queestion;
var newDiv = document.createElement("div");
newDiv.className = 'c-infoo';
var newContent = document.createElement('label');
newContent.className = 'abs-tlt';
newDiv.appendChild(newContent);
newContent.innerHTML = titleinput + " : ";
document.getElementById('tblreserve').appendChild(newDiv);
var string = "<input ";
for (var y = 0; y < schema[i].attrs.length; y++) {
string += schema[i].attrs[y].attr.name + '="' + schema[i].attrs[y].attr.value + '" '
}
string += ">";
newDiv.appendChild = string;
}
}
}
,<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<div id="tblreserve"></div>
(所有3都返回true),public int tileSize = 25;
public int row;
public int x = 0, y = 0;
和public void draw(Graphics g){
`g.setColor(new Color(38, 127, 0));`
g.fillRect(0, 0, 650, 550);
g.setColor(Color.black);
for(int row = 0; row <= 650; row++) {
g.drawRect(x, y, tileSize, tileSize);
row = row + 25;
x = x + 25;
y = y + 0;
}
}
添加到我的自定义日组件中的视图并且可以在一天内工作,但是当用户将手指移动到第二天时,直到手指被抬起并再次戴上它才会调用其处理程序。
onMouseEnter
并将其处理程序传递给所有日期。嗯这个是盲目的尝试。如果它确实有效,那就没有多大意义了:)
我在父日历组件中创建了onStartShouldSetResponder
,并将onMoveShouldSetResponder
传递给了每一天。它与方法1的工作方式相同。
我肯定会采用的方法:
onResponderTerminationRequest
但对于更文明的年龄,必须有一种更简单,更优雅的方法,对吧? :)