程序设计

专业和发烧友程序员的问答



27
NoClassDefFoundError-Eclipse和Android
我在尝试运行一个Android应用程序时遇到问题,直到向其构建路径添加第二个外部库为止,它运行良好。由于添加了scoreninja jar,当我尝试运行应用程序时,现在出现了NoClassDefFoundError。 这是消息: 02-11 21:45:26.154: ERROR/AndroidRuntime(3654): java.lang.NoClassDefFoundError: com.scoreninja.adapter.ScoreNinjaAdapter 由于所有的构建脚本都是由Android工具生成的(?),所以我不确定除了清理,重建或重新启动Eclipse外我还能做些什么(我已经尝试了全部三个)。有人知道我该如何修改吗?
193 java  android  eclipse  ant  build 



10
Android API 21工具栏填充
如何摆脱Android SDK API版本21(支持库)在新工具栏中的多余填充? 我说的是这张图片上的红色箭头: 这是我正在使用的代码: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:background="?attr/colorPrimary" android:padding="0dp" android:layout_margin="0dp"> <RelativeLayout android:id="@+id/action_bar_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="0dp" android:padding="0dp" android:background="#000000"> <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content"/> </RelativeLayout> </Toolbar> 如您所见,我将所有相关的填充都设置为0,但是Spinner周围仍然有填充。我做错了什么或需要做什么才能摆脱多余的填充? 编辑 有些人质疑为什么我要这样做。 根据材料设计规范,旋转器应位于左侧72dp 我需要抵消Google放置在其中的填充,以便正确放置微调框: 编辑2 按照下面Chris Bane的回答,我将contentInsetStart设置为0。对于支持库,您将需要使用应用程序名称空间: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="@dimen/action_bar_height" android:background="?attr/colorPrimary" android:contentInsetStart="0dp" android:contentInsetLeft="0dp" app:contentInsetLeft="0dp" app:contentInsetStart="0dp" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> </android.support.v4.widget.DrawerLayout> …

7
AngularJS:ng-show / ng-hide不适用于`{{}}`插值
我试图使用AngularJS提供的ng-show和ng-hide函数显示/隐藏一些HTML 。 根据文档,这些功能的各自用法如下: ngHide – {表达式}-如果表达式为true,则分别显示或隐藏该元素。ngShow – {表达式}-如果表达式为真,则分别显示或隐藏该元素。 这适用于以下用例: <p ng-hide="true">I'm hidden</p> <p ng-show="true">I'm shown</p> 但是,如果我们使用对象中的参数作为表达式,则ng-hide和ng-show被赋予正确的true/ false值,但这些值不会被视为布尔值,因此始终返回false: 资源 <p ng-hide="{{foo.bar}}">I could be shown, or I could be hidden</p> <p ng-show="{{foo.bar}}">I could be shown, or I could be hidden</p> 结果 <p ng-hide="true">I should be hidden but I'm actually shown</p> <p ng-show="true">I …

4
在使用Git和命令行合并期间如何保留本地文件或远程文件?
我知道如何使用vimdiff合并修改,但是,假设我只知道整个文件可以保留或丢弃,那该怎么办? 我不想为它们中的每一个打开vimdiff,而是更改为想要一个说“保持本地”或“保持远程”的命令。 EG:我合并了带有标记为已更改的文件,因为有人在Windows下打开了它,更改了EOL,然后提交了。合并时,我只想保留自己的版本并丢弃他的版本。 我也有相反的兴趣:我浪费了很多时间,想接受远程文件,放弃所做的更改。
193 git  merge  local 

4
Swift 2.0-二进制运算符“ |” 不能应用于两个UIUserNotificationType操作数
我正在尝试通过以下方式为本地通知注册我的应用程序: UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil)) 在Xcode 7和Swift 2.0中,出现错误Binary Operator "|" cannot be applied to two UIUserNotificationType operands。请帮我。
193 ios  swift  swift2 

30
在大写字母之前添加空格
给定字符串“ ThisStringHasNoSpacesButItDoesHaveCapitals”,什么是在大写字母之前添加空格的最佳方法。因此,结束字符串将为“此字符串没有空格,但确实有大写字母” 这是我对RegEx的尝试 System.Text.RegularExpressions.Regex.Replace(value, "[A-Z]", " $0")
193 c#  regex  string 

13
什么是反模式?
我正在研究模式和反模式。我对模式有一个清晰的主意,但我没有反模式。网络和维基百科的定义让我非常困惑。 有人可以简单地向我解释什么是反模式吗?什么目的?他们在做什么?是好事还是坏事?

6
Python:为什么functools.partial是必需的?
部分应用程序很酷。哪些功能functools.partial提供了lambda无法获得的功能? >>> sum = lambda x, y : x + y >>> sum(1, 2) 3 >>> incr = lambda y : sum(1, y) >>> incr(2) 3 >>> def sum2(x, y): return x + y >>> incr2 = functools.partial(sum2, 1) >>> incr2(4) 5 是functools某种方式更有效或更可读吗?

7
如何在批处理文件中循环匹配通配符的文件
我有一组基本文件名,每个名称'f'都有两个文件,'f.in'和'f.out'。我想编写一个批处理文件(在Windows XP中),它遍历所有文件名,每个文件名都应: 显示基本名称“ f” 对“ f.in”执行操作 对“ f.out”执行其他操作 除了搜索* .in(或* .out)之外,我没有任何方法列出基本文件名。


9
您如何撤消最后的git add?
是否可以取消登载git的最后一个登台(未提交)更改?假设当前分支中有很多文件,有些已上演,有些则没有。在某些时候,一些愚蠢的程序员不小心执行了: git add -- . ...代替: git checkout -- . 现在,该程序员可以使用一些神奇的git命令来取消最后一次更改吗?还是他应该先进行实验才能做出承诺?
193 git 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.