小编Mik*_*679的帖子

Android:语音识别附加词典?

我在Android中使用语音识别器意图.有没有办法将自己的自定义单词或短语添加到Android的语音识别'词典'

android speech-recognition dictionary

6
推荐指数
1
解决办法
8802
查看次数

Java日历问题设置为12pm

我正在创建一个Calendar实例(当前时间),然后设置小时分钟和上午/下午

Calendar now = Calendar.getInstance();

now.set(Calendar.HOUR,12);
now.set(Calendar.MINUTE,0);
now.set(Calendar.AM_PM,1);
Run Code Online (Sandbox Code Playgroud)

然后,如果我尝试从现在的Calendar实例中获取am/pm,它将错误地始终设置为am并提前1天.这似乎只发生在12小时而没有其他小时.这是什么问题?我设置它们的顺序是重要还是在第12小时的情况下,我应该使用24小时格式来设置'now'实例吗?是的我应该提到,这是在Android上.

java calendar

6
推荐指数
1
解决办法
7658
查看次数

AngularJs将HTML中每个ng-repeat的实例传递给指令

我认为这应该很简单,但我错过了一些东西.我如何传递一个flowObj在我ng-repeat下面我的指令?我想将它传递给我的指令然后点击使用FlowObj然后应用一些逻辑.我尝试在我的指令中使用注释代码

scope: { 
    test:"@" 
}
Run Code Online (Sandbox Code Playgroud)

但它似乎搞砸了我的CSS.

HTML:

<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
            <div id="center_outer">
                <div id="center_inner"  ng-controller="CtrlPageFlow"> 
                    <div flowclick   class="cflow" ng-repeat="flowObj in flows"   >
                        {{flowObj.name}}
                    </div>
                </div>
            </div>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是我的指示

angular.module('directives', ['opsimut']).directive('flowclick', function() {
    return {   
        /* 
        scope: {
            test:"@"   // set the attribute name on the directive's scope
        },
        */
        link: function(scope, elem, attr) {
            elem.bind('click', function(scope) {
                debugger;
                alert(scope.flowObj);
                //scope.name += '!';
                //scope.$apply();
            });
        }
    };
}); …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-directive angularjs-ng-repeat

6
推荐指数
1
解决办法
4909
查看次数

Android EditText:如何在键入时应用前景颜色跨度?

我在您键入文本时尝试将字体颜色应用于EditText中的文本.但是,它只是非常不一致,这意味着有时如果键入空格,该空格前面的文本将返回默认的黑色.或者如果我把光标放在一个单词的中间并开始输入整个单词改变颜色而不仅仅是我正在键入的文本.粗体,斜体和下划线似乎运作良好.我怎样才能保证只有我输入的文字会受到字体颜色的影响?

请参阅下面的"尺寸和颜色"评论...

     contentEdit.addTextChangedListener(new TextWatcher() { 
            public void afterTextChanged(Editable s) { 

                //add style as the user types if a toggle button is enabled
                ToggleButton boldButton = (ToggleButton) findViewById(R.id.bold);
                ToggleButton emButton = (ToggleButton) findViewById(R.id.italic);
                ToggleButton underlineButton = (ToggleButton) findViewById(R.id.underline);

                int position = Selection.getSelectionStart(contentEdit.getText());

                try{
                    if (position < 0){
                        position = 0;
                    }

                    if (position > 0){

                        if (styleStart > position || position > (cursorLoc + 1)){
                            //user changed cursor location, reset
                            if (position - cursorLoc > 1){
                                //user pasted text
                                styleStart = …
Run Code Online (Sandbox Code Playgroud)

android richtext android-edittext

6
推荐指数
2
解决办法
4882
查看次数

如何导入3D场景(带.mtl文件的.obj文件)

我买了一个房间的3D模型.该模型采用的.obj格式.现在,我正在尝试将此模型导入Unity3D.

该模型带有:

  • 5x .obj档案
  • 5x .mtl档案
  • nx .jpg档案
  • nx .tga档案

The .mtl files contained paths that do not exist on my PC. So I removed the paths. The images files (.jpg & .mtl) are in the same directory as the .obj files. When I tried to import the .obj files, the room has no material on it. I then tried to use the FBX converter (with "Embed media" …

import unity-game-engine material fbx

6
推荐指数
1
解决办法
3万
查看次数

GWT在页面/面板之间滑动

我有一个我正在创建的Web应用程序,我需要允许用户在页面之间滑动.根据我一直在研究的内容,您需要使用MGWT(移动Google网络工具包 - http://code.google.com/p/mgwt/)

然后你必须创建一个扩展Panel类的类,并实现MGWT的"HasTouchHandlers"接口:

(http://code.google.com/p/mgwt/source/browse/mgwt/src/main/java/com/googlecode/mgwt/ui/client/widget/touch/TouchPanel.java?name=v1.0.0 -alpha1)

您的Panel也应该实现GWT的AnimatedLayout接口(例如LayoutPanel,DockLayoutPanel和SplitLayoutPane),因此您可以在拦截触摸事件后本机滑动Panel.

我的问题是,任何人都可以指向我如何做到这一点的教程或示例代码?或者如何根据Panels布局GWT项目?例如,如果我的应用程序中有多个页面,我是否有多个面板?谢谢 - 迈克

gwt panel swipe

5
推荐指数
1
解决办法
3136
查看次数

ipad上的Javascript加载缓慢

我有一个基本的HTML网站(html5,JavaScript,jQuery),我在iPpad2上运行.我使用谷歌浏览器进行基本测试,只是为了测试布局图像和复制等.我的真实测试需要在真正的iPad上.

在iPad上,我的代码似乎有2-4秒的延迟,而Chrome则立即加载.我一直无法找到瓶颈.我在代码中的各个点添加了警报,但所有警报立即出现,一个接着一个,似乎延迟发生在最后一个代码的最后一个警报之后.

警报可能会产生误导,因为代码在执行之前可能会被缓存?为了加快iPad上的速度,我的代码中是否应该寻找或避免?

javascript html5 latency ipad

5
推荐指数
2
解决办法
3011
查看次数

基于Android位置的提醒/事件?

我正在寻找关于当用户设备接近预定义位置时如何获取事件的代码示例.我在这里看到如何使用Google Places API获取自动填写的地点列表:

https://developers.google.com/places/training/autocomplete-android

使用基于上述的位置,当用户接近他们选择的位置时,如何通知我的应用.如果我创建的服务不断轮询位置,那么Google PLaces API的每日使用量将超过分配的金额(您每天只能获得1,000个请求)...

events android location reminders

5
推荐指数
1
解决办法
1367
查看次数

数据绑定编译器错误:"无法解析SafeVarargs的类型"

我一直在努力让Android数据绑定工作2天,并且在问题发布之后一直是编译器问题,而现在这个问题我已经完全碰壁了.我用Google搜索,没有任何东西可以找到.

这是完整的日志:

java.lang.RuntimeException: failure, see logs for details.
cannot generate view binders java.lang.RuntimeException: failure, see logs for details.
Cannot resolve type for SafeVarargs
    at android.databinding.tool.util.L.printMessage(L.java:128)
    at android.databinding.tool.util.L.e(L.java:101)
    at android.databinding.tool.expr.Expr.getResolvedType(Expr.java:320)
    at android.databinding.tool.expr.ExprModel.seal(ExprModel.java:477)
    at android.databinding.tool.LayoutBinder.sealModel(LayoutBinder.java:327)
    at android.databinding.tool.DataBinder.sealModels(DataBinder.java:65)
    at android.databinding.tool.CompilerChef.sealModels(CompilerChef.java:169)
    at android.databinding.annotationprocessor.ProcessExpressions.writeResourceBundle(ProcessExpressions.java:149)
    at android.databinding.annotationprocessor.ProcessExpressions.onHandleStep(ProcessExpressions.java:82)
    at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.runStep(ProcessDataBinding.java:154)
    at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.access$000(ProcessDataBinding.java:139)
    at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:66)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:439)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:45)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:101)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
    at …
Run Code Online (Sandbox Code Playgroud)

data-binding android compiler-errors

5
推荐指数
1
解决办法
4060
查看次数

命令行上拉取请求的 Git 语法

我在这里看到文档:https : //git-scm.com/docs/git-request-pull

但我不确定如何将它应用于我正在尝试做的事情。我推送到名为“fix/fixNumberHere”的分支,我想使用拉取请求合并到名为“mergeBranch”的分支——如何将其应用于:

 git request-pull [-p] <start> <url> [<end>]
Run Code Online (Sandbox Code Playgroud)

git command-line pull-request

5
推荐指数
1
解决办法
9130
查看次数