在我的自定义视图中检测长按时遇到问题.
这是与此问题相关的代码
final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
public void onLongPress(MotionEvent e) {
Log.e("dbg_msg", "onLongPress");
}
});
public boolean onTouchEvent(MotionEvent event) {
return gestureDetector.onTouchEvent(event);
};
Run Code Online (Sandbox Code Playgroud)
长按此代码可检测每一次(短)点击.
当我把这个代码放在从Activity继承的类中时,它可以工作.
那为什么它不能在自定义视图中工作?
我正在尝试在新的Symfony2项目中使用我自己的bundle.我创建了项目,然后使用composer安装了所有必需的包.
这是我的项目的composer.json文件
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/", "SymfonyStandard\\": "app/SymfonyStandard/" }
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"trancynn/devana-book-app": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个网络应用程序,允许用户在 iframe 元素中拖动 div。
这是我当前在 index.html 中的代码:
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script>
function onDrag(event){
event.dataTransfer.setData('Text', 'Some content');
}
</script>
<div id="items">
<ul>
<li><div draggable="true" ondrag="onDrag(event)">Content1</div></li>
<li><div draggable="true" ondrag="onDrag(event)">Content2</div></li>
</ul>
</div>
<iframe id="box" src="box.html">
</iframe>
Run Code Online (Sandbox Code Playgroud)
这是我来自 box.html 的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<script>
function onDrop(event){
event.target.innerHTML += event.dataTransfer.getData('Text');
alert('Ok!');
}
function onDragOver(ev){
ev.preventDefault();
}
</script>
</head>
<body ondragover="onDragOver(event)" ondrop="onDrop(event)">
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
拖动有效,我什至从 onDrop 函数收到该警报,但event.dataTransfer.getData('Text')返回空字符串,我不知道为什么。
提前致谢
我正在使用jQuery Mobile和CodeMirror作为代码编辑器创建移动应用程序.我不是设计师所以我通常不会搞乱CSS.
这是我到目前为止有效的XHTML http://img203.imageshack.us/img203/9480/screenshotfrom201212081.png.
我希望CodeMirror控件可以向下拉伸到页脚.Css高度属性在这里不起作用.
//编辑
问题在于父DIV的高度,对不起
android ×1
codemirror ×1
composer-php ×1
css ×1
html ×1
javascript ×1
packagist ×1
php ×1
sizing ×1
symfony ×1