Questions tagged «android»

Android是Google的移动操作系统,用于对数字设备(智能手机,平板电脑,汽车,电视,Wear,Glass和IoT)进行编程或开发。对于与Android相关的主题,请使用特定于Android的标签,例如android-intent,android-activity,android-adapter等。对于与开发或编程无关但与Android框架相关的问题,请使用以下链接:https:// android.stackexchange.com。

7
使用Gradle无法解析Aar库的传递依赖
我调查了一段时间,可能在这里看到了与aar和可传递依赖项有关的最流行的答案,但是对于我来说,如何使它起作用仍然不清楚。 所以: 我有给定gradle配置的android库: apply plugin: 'android-library' apply plugin: 'android-maven' version = "1.0.0" group = "com.somepackage" buildscript { repositories { mavenCentral() mavenLocal() } dependencies { classpath 'com.github.dcendents:android-maven-plugin:1.0' } } android { compileSdkVersion 19 buildToolsVersion '19.0.3' defaultConfig { minSdkVersion 10 } } repositories { maven { url 'http://www.bugsense.com/gradle/' } } dependencies { …

19
如何防止在按下按钮时两次加载活动
如果试图在第一次单击后立即按两次按钮,则试图阻止两次加载活动。 我有一个点击一下按钮就会加载的活动 myButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { //Load another activity } }); 现在,由于要加载的活动具有网络调用,因此加载(MVC)需要一些时间。我确实为此显示了加载视图,但是如果在此之前我按了两次按钮,则可以看到活动被加载了两次。 有人知道如何预防吗?


9
不同口味的不同应用名称?
我有2种构建口味,例如,flavor1和flavor2。 我想我的应用程序被命名,比如“ AppFlavor1 ”当我建立flavor1和“ AppFlavor2 ”当我建立的味道2。 这不是我要更改的活动的标题。我想更改应用程序名称,因为它显示在电话菜单和其他地方。 从build.gradle我可以为自己的口味设置各种参数,但似乎不是应用程序标签。而且我也无法基于某些变量以编程方式更改应用程序标签。 那么,人们如何处理呢?
93 android  gradle 

17
如何在Android中检测向左或向右滑动?
我EditText在android中有一个视图。在此我想检测向左或向右滑动。我可以使用下面的代码在空白处获取它。但这在我滑动时不起作用EditText。我怎么做?如果我做错了事,请告诉我。谢谢。 使用的代码: switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { oldTouchValue = touchevent.getX(); break; } case MotionEvent.ACTION_UP: { float currentX = touchevent.getX(); if (oldTouchValue < currentX) { // swiped left } if (oldTouchValue > currentX ) { swiped right } break; } }

28
在Android Studio中找不到默认活动
我刚刚升级到Android Studio 0.2.8,尝试编辑运行配置时出现错误消息“找不到默认活动”。 当我启动Android Studio时,出现此错误“仅允许从事件分发线程进行访问” 我正在使用的活动是片段活动。 到目前为止,我已经尝试过重新构建并使缓存/重新启动无效。两者都没有用。 请让我知道如何解决此问题。

13
Android Studio-无模块
我是Android Studio的新手,这是我的项目屏幕截图。我的项目构建成功,但运行时仅显示“构建成功”。 据我了解,我认为工具栏上的构建位置应该是我的项目名称。当我进入Module内部的Edit Configuration时,只有一个选项是No Module,而我认为我的项目名称应该在那里。单击我的项目,然后单击使模块“ IBL2 eclipse的副本”没有任何反应。此项目在Eclipse中运行良好。

21
RecyclerView中的CheckBox继续检查其他项目
这是RecyclerView中我商品的XML <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/cvItems" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_margin="2dp" card_view:cardElevation="0dp" card_view:contentPadding="0dp" card_view:cardBackgroundColor="#FFFFFF" > <LinearLayout android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent"> <TextView android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.8" android:id="@+id/tvContent" android:textSize="15dp" android:paddingLeft="5dp" android:paddingRight="5dp" /> <CheckBox android:id="@+id/cbSelect" android:layout_width="0dip" android:layout_weight="0.2" android:layout_height="match_parent" android:button="@drawable/cb_checked" android:gravity="center_horizontal" android:textAlignment="center" android:layout_gravity="center_horizontal" /> </LinearLayout> </android.support.v7.widget.CardView> 这是RecyclerView适配器,可以为其每个项目增加上面的布局: public class AdapterTrashIncome extends RecyclerView.Adapter<AdapterTrashIncome.ViewHolder> { private ArrayList<ObjectIncome> myItems = new ArrayList<>(); …

20
软件包签名与以前安装的版本不匹配
这是我的项目:https://github.com/kenpeter/my_hak_news,这是直接拷贝https://github.com/grigio/HAgnostic-News。 Git克隆https://github.com/kenpeter/my_hak_news,然后运行react-native run-android 得到这个错误: * What went wrong: Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.hagnosticnews signatures do not match the previously installed version; ignoring! 相关问题:https : //github.com/grigio/HAgnostic-News/issues/1,我遵循各种方法,但无法解决此问题。



11
Android上的React Native无法找到构建工具
是什么引起以下问题?我的Android SDK版本不受支持吗? Starting JS server... Building and installing the app on the device (cd android && gradlew.bat installDebug)... FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > failed to find Build Tools revision 23.0.1

30
Android设备选择器-设备未显示
我正在使用Eclipse + ADT,并且我的物理设备(在下面列出)在Android设备选择器中未列出。我已经更新了Eclipse和所有Android软件包。我的手机运行的是Android OS 1.6,它对应于Eclipse Project中列出的目标版本。 另外,我决定尝试在真实设备上进行测试的原因是,当我运行项目时,模拟器似乎不再正常工作。模拟器将启动,但程序永远不会启动。有任何想法吗? (使用Windows 7 / t-mobile mytouch 3g)

16
Android意向过滤器:将应用程序与文件扩展名关联
我有一个要与我的应用程序关联的自定义文件类型/扩展名。 据我所知,数据元素是为此目的而制作的,但我无法使其正常工作。 http://developer.android.com/guide/topics/manifest/data-element.html 根据文档以及许多论坛帖子,它应该像这样工作: <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="application/pdf" /> </intent-filter> 好吧,它不起作用。我做错什么了?我只想声明自己的文件类型。


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.