我在我的应用程序上使用grunt运行了业力,但由于某种原因,事情停止了工作.我通过重新安装更新了业力,这改变了很多,并更改了我的配置文件.我的所有文件都被添加和提供,但是它没有执行我的任何测试.
暂时(只是试图让事情再次运行),我正在使用命令在grunt之外运行karma start <pathtomyconfigfile>
.使用LOG_DEBUG选项,我看到所有添加和服务.
这是我的配置文件:
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'../build/angular/angular.js',
'../build/angular/angular-mocks.js',
'../build/angular/angular-resource.js',
'../build/angular/angular-cookies.js',
'../build/angular/angular-scenario.js',
'../src/**/*.js',
'../dist/tmp/**/*.js',
'../vendor/angular-bootstrap/*.js',
'../vendor/angular-ui-utils/modules/route/*.js',
'../vendor/angular-ui-utils/modules/mask/*.js'
],
// list of files to exclude
exclude: [
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: …
Run Code Online (Sandbox Code Playgroud) 我目前正试图找出如何在不重新加载整个页面的情况下更改路由参数.例如,如果我开始
但将名称更新为"George",将路线更改为:
http://www.example.com/#/page/george
如果我已经有http://www.example.com/#/page/:name路由.
没有重新加载位置.可以设置$ routeParams.name ="George"吗?
编辑: 或者,有没有办法更新http://www.example.com/#/page?name=George而无需重新加载或重置页面?
我已经在应用程序结算v3中实现了我的应用程序大约一个星期了.我使用了很多android的示例代码来简化集成.我经常记录崩溃,我似乎无法重现:
Exception Type: java.lang.RuntimeException
Reason: Unable to destroy activity {[package].billing.BillingActivity}: java.lang.IllegalArgumentException: Service not registered: [package].billing.util.IabHelper$1@40646a70
Run Code Online (Sandbox Code Playgroud)
它似乎在这条线上打破:
if (mContext != null) mContext.unbindService(mServiceConn);
Run Code Online (Sandbox Code Playgroud)
我在我的onCreate方法中绑定了这个服务,并将它放在我的onDestroy方法中(这是记录此错误的地方).有什么指针吗?
我目前正在进行动态更新ProgressBar
.通过一定的百分比,progessbar设置了不同颜色的drawable.我们目前有一个可绘制的xml中定义的各种彩色夹子drawable.题为progressbar_blue_states
的详细信息如下:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background"
android:drawable="@drawable/progressbar_grey">
</item>
<item android:id="@android:id/progress">
<clip android:drawable="@drawable/progressbar_blue" />
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
每当我们需要更新对话框时,我们都会调用以下代码:
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_blue_states));
Run Code Online (Sandbox Code Playgroud)
但是,这不仅不会更新ProgressBar,而且还会完全取出进度条,其中留有空格.但是,如果我android:progressDrawable="@drawable/progressbar_blue_states"
在xml中设置并取出此setProgressDrawable()
调用,则会正确加载.我们需要setProgressDrawable来根据需要更新颜色.
此调用在Android 4.0 +中运行良好,但在Android 2.3中我们遇到了一些麻烦.有任何想法吗?
编辑
这就是我们在xml中设置ProgressBar的方法:
<ProgressBar android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="2dp"
android:indeterminate="false"
android:indeterminateOnly="false"
android:progress="24"
android:max="100"
android:progressDrawable="@drawable/progressbar_red_states" />
Run Code Online (Sandbox Code Playgroud) 一个新手Jasmine/Angular问题.
我在控制器中有一个命名函数,如下所示:
.controller( 'DummyCtrl', function DummyCtrl($scope){
var doSomething = function() {
return "blah";
};
})
Run Code Online (Sandbox Code Playgroud)
我需要测试这个函数,并尝试通过调用以下Jasmine规范:
describe ('myApp', function(){
var $scope, $controller;
var DummyCtrl;
beforeEach(module('myApp'));
describe('controllers', function(){
beforeEach(inject(function ($controller, $rootScope){
$scope = $rootScope.$new();
DummyCtrl = $controller('DummyCtrl', {$scope: $scope});
}));
describe( 'DummyCtrl', function(){
var blah;
beforeEach(function(){
blah = DummyCtrl.doSomething();
});
it('should do something', function(){
expect(blah).toContain("blah");
});
});
});
});
Run Code Online (Sandbox Code Playgroud)
我没有解决问题,而是导致以下错误:TypeError: Object #<DummyCtrl> has no method 'doSomething'
.我假设这是一个非常简单的东西,我不理解.
我正在尝试使用ant构建我的android项目(它在eclipse中运行良好).我使用以下构建失败行运行错误:
BUILD FAILED
.../android_sdks/tools/ant/build.xml:680: The following error occurred while executing this line:
.../android_sdks/tools/ant/build.xml:693: Compile failed; see the compiler error output for details.
Run Code Online (Sandbox Code Playgroud)
上面的java编译有很多错误,所有这些错误都找不到符号错误.这些符号中的大多数是添加到R文件的变量.还有一些是项目中的课程.
我使用以下方法设置构建环境:
android update project --path .
Run Code Online (Sandbox Code Playgroud)
我的工具和platform_tools都是最新的,我在android-7上运行.我已经刷新了项目,对项目进行了清理,甚至重启了eclipse.
我是蚂蚁的新手,我很感激任何建议.
构建失败的输出(根据要求,我为格式化问题道歉):
MacBook-Pro:[公司] _Android $ ant clean debugBuildfile:[android_path] /build.xml
-check-env:
[checkenv] Android SDK Tools Revision 20
[checkenv] Installed at [path]/android_sdks
-setup:
[echo] Project Name: SplashActivity
[gettype] Project Type: Application
[echo] Switching between debug and non debug build: Deleting previous compilation output...
[delete] Deleting directory [android_path]/bin/classes
-pre-clean:
clean:
[delete] Deleting directory …
Run Code Online (Sandbox Code Playgroud) 我目前正在设计一个带有5个按钮的ButtonBar(它们都是ImageButtons,但目前只有3个).这是我的第一个android项目,所以我正在学习.我试图平均加权每个按钮,而不缩放它们(具有相等的填充而不是相等的宽度).到目前为止这是我的代码:
<LinearLayout
android:id="@+id/back"
android:orientation="horizontal"
android:layout_height="50dip"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:background="#000000"
style="@android:style/ButtonBar"
android:weightSum="5"
>
<ImageButton
android:id="@+id/info_button"
android:padding="20dp"
android:background="@drawable/info"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
/>
<Button
android:id="@+id/wishlist_button"
android:text="@string/wish_label"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
android:padding="20dp"
android:textSize="15dip"
android:textColor="#b7b7b7"></Button>
<Button
android:id="@+id/buy_button"
android:text="@string/buy_label"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
android:padding="20dp"
android:textSize="15dip"
android:textColor="#b7b7b7"/>
<ImageButton
android:id="@+id/dislike_button"
android:padding="20dp"
android:background="@drawable/dislike_button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
/>
<ImageButton
android:id="@+id/like_button"
android:padding="20dp"
android:background="@drawable/like_button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
/>
Run Code Online (Sandbox Code Playgroud)
这就是它现在的样子:拉伸加权:http://i.imgur.com/MAfjp.png
这就是我希望它看起来像(紧密):非拉伸同样填充:http://i.imgur.com/vXTEy.png
谢谢你的帮忙.我一直在寻找答案,并且已经尝试了很多.
我正在尝试在我的Dropwizard实例中添加自定义标头过滤器,以检查请求的版本是否同步到Dropwizard实例的版本.
我看到你可以FilterBuilder
用来添加码头CrossOriginFilters
.但是,我无法弄清楚如何设置自定义过滤器.
谢谢
android ×4
angularjs ×3
ant ×1
dropwizard ×1
jasmine ×1
jetty ×1
karma-runner ×1
layout ×1
routes ×1
unit-testing ×1
xml ×1