草庐IT

true_false

全部标签

android-studio - Kotlin 抑制 'condition is always true'

在无数次检查中浪费了更多时间(我知道如何启用和禁用),我找不到任何方法来禁用对我的'Conditionisalwaystrue'的特定检查AndroidStudio中的Kotlin(不是Java)文件。我知道我在做什么,根本不需要这种检查,但更恰本地说,我想为文件、类或函数或任何东西禁止它。一如既往的令人沮丧。//I'mwellawaretheconditionbelowisALWAYStrueif(ANDROID_IS_AWESOME){fml()} 最佳答案 在Kotlin中,使用ConstantConditionIf忽略此警告

java - 错误 :Kotlin: Unsupported plugin option: org. jetbrains.kotlin.android:enabled=true

今天我收到此错误,而一小时前完全相同的代码正在运行Error:Kotlin:Unsupportedpluginoption:org.jetbrains.kotlin.android:enabled=true这个,项目不运行:Cause:duplicateentry:...更新:从用户文件夹中删除.AndroidStudio文件夹已解决问题,至少目前如此!这是我的build.gradle:configurations.all{resolutionStrategy{force"com.android.support:appcompat-v7:$project.andySDK"force"c

java - EditText.setFocusable(false);不能设置为真。 :/

一个非常奇怪的情况,我有这段代码,如果SpnSelected.equals("Service")和可再次编辑,它应该使EditText文件不可编辑,如果它是别的东西。finalEditTextetAdd=(EditText)dialogAddTextView.findViewById(R.id.etSymb);if(SpnSelected.equals("Service")){etAdd.setFocusable(false);TextViewtvInfo=(TextView)dialogAddTextView.findViewById(R.id.tvAddTextInfo);}els

android:textAllCaps ="false"不适用于 TabLayout 设计支持

我在我的android.support.design.widget.TabLayout中设置了android:textAllCaps="false"认为它只显示全部大写的选项卡标题。如何删除所有大写字母? 最佳答案 设计库23.2.0+更新原始答案不适用于设计库23.2.0或更高版本。感谢@fahmad6在评论中指出,如果有人错过了该评论,我会把它放在这里。您需要将textAllCaps和android:textAllCaps都设置为false以禁用所有大写设置。falsefalse原始答案默认情况下,选项卡由TabLayout创建

android - android :supportsRtl ="true" in AndroidManifest xml file有什么用

每当我在androidstudio中创建新项目时,我都会在我的应用AndroidManifest文件中获得android:supportsRtl="true"。...在应用中使用什么,或者在我的应用中添加或不添加AndroidManifest时有什么优点和缺点。 最佳答案 Declareswhetheryourapplicationiswillingtosupportright-to-left(RTL)layouts.IfsettotrueandtargetSdkVersionissetto17orhigher,variousRTL

android - 将 largeHeap 设置为 true 有什么好处?

我有一个包含大量类和许多库的应用程序,我正在设置android:largeHeap="true"因为我遇到内存问题,我的list文件代码已附加。我不得不问这是一个好习惯吗?请提出使用它的优点和缺点(优点和缺点)。 最佳答案 在这里聚会太晚了,但无论如何我都会提供我的0.02美元。这不是一个好主意However,theabilitytorequestalargeheapisintendedonlyforasmallsetofappsthatcanjustifytheneedtoconsumemoreRAM(suchasalargeph

android - 进一步理解 setRetainInstance(true)

当您在Fragment上调用setRetainInstance(true)时,究竟会发生什么?文档几乎不存在,这似乎是一个非常重要的功能。具体来说,我想知道这个序列(我编造的)有多少是真的:Theuserrotatesthedevice.ThefragmentisdetachedfromtheActivityandFragment.onDetach()iscalled.Theactivityisdestroyed;Activity.onDestroy()iscalled.TheActivityjavaobjectisdeleted(whenpossible,bytheGC).AnewA

android - ADT 何时将 BuildConfig.DEBUG 设置为 false?

在最新版本的ADT(r17)中,添加了根据构建类型设置的生成常量BuildConfig.DEBUG。我遇到的问题是它永远不会设置为false,我希望它在执行“Android工具->导出签名的应用程序包”时会改变,但它对我来说没有。那么如何更改构建类型?Addedafeaturethatallowsyoutorunsomecodeonlyindebugmode.BuildsnowgenerateaclasscalledBuildConfigcontainingaDEBUGconstantthatisautomaticallysetaccordingtoyourbuildtype.Youc

android - 将baselineAligned设置为false如何提高LinearLayout的性能?

我只是在xml中构建一些UI,Lint给了我一个警告并说将android:baselineAligned设置为false以提高ListView的性能。添加此警告的Lint更改文档说Layoutperformance:FindsLinearLayoutswithweightswhereyoushouldsetandroid:baselineAligned="false"forbetterperformance,andalsofindscaseswhereyouhavenestedweightswhichcancauseperformanceproblems.有人可以解释为什么这会提高性能

使用匹配的分片键和 multiple=true 进行 MongoDB 更新

MongoDB建议对指定'multi:false'选项的分片集合的所有update()操作必须在查询条件中包含分片键,以便查询只命中一个特定的分片集群。如果没有找到分片键且'multi:false',则返回此错误(参见http://docs.mongodb.org/manual/core/sharded-cluster-query-router/):updatedoesnotcontain_idorshardkeyforpattern我正在切换我的代码以使用分片集合。我的代码默认使用update()和'multi:true',我不想更改该默认选项以避免上述任何潜在错误。我的问题是,如果