草庐IT

task-switching

全部标签

android - 使用 Switch 语句处理按钮点击

我正在尝试围绕View、监听器等进行思考。我有一个带有2个按钮的Activity:buttonplay和buttonstop。我的问题是我无法完全围绕Views和Listeners来生成有效的switch语句。例如,我想创建一个SINGLEListener并以某种方式使用它来确定单击了哪个按钮。然后以某种方式使用在我的switch语句中单击的按钮的ID,但是我在网上找到的所有内容似乎都对每个按钮使用SEPARATE监听器,然后以某种方式使用View作为Switch语句的参数。我意识到下面的代码不正确,但我正在寻找我需要进行哪些更改才能完成上述操作。我想根据单击的按钮来控制MediaPl

安卓 : Required API to use Switch?

由于以下错误,我无法在我的项目中插入Switch:ViewrequiresAPIlevel14(currentminis8):但是在我的项目属性中,我使用的是Platform4.1和APILevel16。那么有什么问题呢? 最佳答案 GoogleIO2012(startingatslide32)有一个很好的讲座。这是一个详细的例子:通过将其放置在/res/layout-v14中,为ICS+版本创建单独的布局XML文件。生成的文件结构将如下所示:res/layout-mainlayout.xml-compound_button.xml

Android studio 3.0 Canary 6 执行 com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction 时发生故障

在我将androidstudio更新到Canary6之前,一切都很好,当我重建或清理或其他项目时,它会抛出:Afailureoccurredwhileexecutingcom.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction这个错误将我引导到我的vectors.xml[他们都得到了这个错误].我当前的应用级别build.gradle:applyplugin:'com.android.application'android{compileSdkVersion25buildToolsVersion"25.0

java - 字体不适用于 CheckBox 和 Switch Android Studio 3

更新到AndroidStudio3并使用最新的SDK和构建工具后,有一个功能可以将字体添加到资源下的fonts文件夹中,并直接在xml或java中使用。我在styles.xml的主题中使用此代码将主题应用于我的整个应用程序@font/iransansfont它适用于Button、TextView以及除了CheckBox和Switch小部件之外的几乎所有东西。我什至在我的CheckBox和Switch上尝试了fontFamily,但它也不起作用。我该如何解决? 最佳答案 目前无法通过XML使用字体资源在CheckBox(和其他一些小部

android - RecyclerView : get position and switch to activity

如何获得在RecyclerView行中被点击的项目的位置,而不是在onClick方法中对Activity做出Intent?这是我的适配器:publicclassSergejAdapterextendsRecyclerView.Adapter{privateLayoutInflaterinflater;Listdata=Collections.emptyList();publicSergejAdapter(Contextcontext,Listdata){inflater=LayoutInflater.from(context);this.data=data;}@Overridepubl

安卓权限: Perform task after user pressed "Allow"

我想知道当用户按下“允许”按钮以访问联系人详细信息/日历访问等时,我们是否可以识别事件,我知道有办法通过ActivityCompat.requestPermissions请求权限,但有没有办法在用户授​​予权限后立即执行操作? 最佳答案 首先定义变量:publicstaticintMY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION=1;请求许可使用:if(ActivityCompat.checkSelfPermission(this,android.Manifest.permission.ACCE

安卓工作室 : execution failed for task : app:compileDebugAidl FAILED

我安装了AndroidStudio1.2.1.1、Gradle版本2.2.1和Android插件版本1.2.3。我试图创建一个简单的helloworld项目,它给了我一个构建失败:app:compileDebugAidlFAILED。我是否遗漏了某些内容或与版本有一些不兼容的问题,因为这应该是一个简单的应用程序。感谢您的帮助。这是我得到的编译错误:Information:Gradletasks[:app:assembleDebug]:app:preBuildUP-TO-DATE:app:preDebugBuildUP-TO-DATE:app:checkDebugManifest:app

Android Studio/Gradle 构建在版本 : Could not determine the dependencies of task ':app:crashlyticsStoreDeobsRelease' 中失败

仅在发布时构建失败,调试构建正常。Androidstudio1.4、Gradle2.8RC1、Gradle插件1.4.0BETA4FAILURE:Buildfailedwithanexception.*Exceptionis:org.gradle.api.GradleException:Couldnotdeterminethedependenciesoftask':app:crashlyticsStoreDeobsRelease'....Error:org.gradle.api.UnknownTaskException:Taskwithpath'dexRelease'notfoundi

android - Gradle 构建工具找不到 play-services-tasks.aar?为什么?

今天突然,我在AndroidStudio中运行我的应用时遇到了错误。它是:Error:Couldnotfindplay-services-tasks.aar(com.google.android.gms:play-services-tasks:15.0.1).Searchedinthefollowinglocations:https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar我没有更改gradle文件中的任何内容,但它突然出现

android - Gradle 构建失败 : Unable to find method 'org.gradle.api.tasks.testing.Test.getTestClassesDirs()Lorg/gradle/api/file/FileCollection;'

当我试图编译一个导入的project从github,我的gradle构建总是失败并出现以下异常。Unabletofindmethod'org.gradle.api.tasks.testing.Test.getTestClassesDirs()Lorg/gradle/api/file/FileCollection;'Possiblecausesforthisunexpectederrorinclude:Gradle'sdependencycachemaybecorrupt(thissometimesoccursafteranetworkconnectiontimeout.)Re-down