Questions tagged «android»

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


12
使GridView项目变为正方形
我希望我的物品GridView摆正。有两列,项目宽度为fill_parent(例如,它们占用尽可能多的水平空间。这些项目是自定义视图。 如何使物品的高度等于其可变宽度?
78 android  gridview 

9
未启用英特尔X86仿真器加速器(HAXM安装程序)VT / NX
我想问如何为MacBook启用VT / NX,当我尝试使用X86仿真器时,在我看来VT / NX未启用,当我更新MacBook后使用10.9系统时从未出现过这种情况在优胜美地看来,在我看来。 当我尝试启动x86模拟器时,它告诉我: Starting emulator for AVD 'X86' emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAX is not installed on this machine (/dev/HAX is missing). 但是AVD告诉我我已经安装了HAXM。 当我尝试再次自行安装时,安装程​​序将打印VT/NX NOT ENABLED。 我无法发布任何图片… to mindex的答案: 我尝试运行所有版本的英特尔HAXM,我可以获得: IntelHAXM_1.0.8.dmg …

9
找不到Gradle DSL方法:“ compile()”
我有此gradle错误。 错误:(9,0)未找到Gradle DSL方法:“ compile()” 我曾尝试参考类似的问题,但没有成功。 Android gradle build错误:(9,0)未找到Gradle DSL方法:“ compile()”。 同步Build.Gradle时出现错误“找不到Gradle DSL方法:'compile()'” 找到了不受支持的Gradle DSL方法:“ compile()”! 我的build.gradle代码在这里 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.0.0' compile 'com.android.support:appcompat-v7:20.+' compile 'com.google.android.gms:play-services:6.5.+' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } …
78 android 

30
新的Google登录Android
我正在尝试使用新的Google Play服务8.3获取用户令牌ID,并且如记录所示,我通过了服务器ID: GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.server_client_id)) .requestEmail() .build(); 但是我仍然无法获得成功的结果,如下所示: {statusCode=unknown status code: 12501, resolution=null} 并记录在这里 GoogleSignInStatusCodes 用户已取消登录。也就是说,用户取消了某些登录解决方案,例如帐户选择或OAuth同意。 常数:12501 事实并非如此,因为我已经选择了一个帐户。知道是什么原因吗?

4
无法在ProgressDialog的AsyncTask内未调用Looper.prepare()的线程内创建处理程序
我不明白为什么会收到此错误。我正在使用AsyncTask在后台运行一些进程。 我有: protected void onPreExecute() { connectionProgressDialog = new ProgressDialog(SetPreference.this); connectionProgressDialog.setCancelable(true); connectionProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); connectionProgressDialog.setMessage("Connecting to site..."); connectionProgressDialog.show(); downloadSpinnerProgressDialog = new ProgressDialog(SetPreference.this); downloadSpinnerProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); downloadSpinnerProgressDialog.setMessage("Downloading wallpaper..."); } 当我doInBackground()根据情况进入时: [...] connectionProgressDialog.dismiss(); downloadSpinnerProgressDialog.show(); [...] 每当我尝试时downloadSpinnerProgressDialog.show(),都会收到错误消息。 有想法吗?


13
如何在Android Gradle中自动增加versionCode
我正在尝试基于Gradle的新的Android构建系统,并且在考虑,用它自动增加versionCode的最佳方法是什么。我在考虑两种选择 创建versionCode文件,从中读取编号,增加编号并将其写回到文件中 解析AndroidManifest.xml,从中读取versionCode,增加它并将其写回到AndroidManifest.xml 还有其他更简单或更合适的解决方案吗? 有没有人使用过其中一种方案,可以与我分享?

12
JavaScript无法在Android Webview中使用?
我正在尝试制作一个相对简单的iOS应用的Android版本,该应用使用Web视图,一些按钮,然后依靠对CMS的JavaScript调用。 但是我还停留在开发的早期阶段:Webview不能与javascript一起使用。我读了很多关于如何在Android Webview中启用JS的文章,但到目前为止还没有运气。 以下是我的一些代码: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.setWebChromeClient(new WebChromeClient()); mWebView.setWebViewClient(new HelloWebViewClient() { @Override public void onPageFinished(WebView view, String url) { //Calling an init method that tells the website, we're ready mWebView.loadUrl("javascript:m2Init()"); page1(mWebView); } }); mWebView.loadUrl("http://my_url/mobile/iphone//app.php"); } private class HelloWebViewClient extends WebViewClient …


4
LocationRequest setInterval(长毫秒)和LocationRequest setFastestInterval(长毫秒)之间的区别
我在android中每隔5分钟编写一次自己的背景位置更新。我想知道setInterval和setFastestInterval之间的区别 当我将Interval设置为5分钟并将setFastestInterval设置为2分钟时。每2分钟调用一次位置更新。 我想知道区别。我不明白此https://developer.android.com/reference/com/google/android/gms/location/LocationRequest.html的开发人员页面中到底写了什么。 另外:仅当第一次更新的距离与第二次更新的距离大于20米时,是否具有内置功能来检查位置更新? 谢谢!


5
如何使用将自定义可绘制对象应用于RadioButton?
看起来我们可以在RadioButton中使用以下内容: android:button="@drawable/myCustomStateBackground" 但是该可绘制对象仅占据无线电可绘制对象正常运行的位置。理想情况下,我希望我的整个按钮背景都保持有状态。因此,当我按下按钮时,我希望整个按钮看起来像卡在按下状态。为此,我希望可以做些类似的事情: android:button="null" android:background="@drawable/myCustomStateBackground" 但是背景可绘制对象不知道按钮状态,就像button属性一样。有办法解决吗?
78 android 

3
在根项目“ myproject”中找不到路径为“:mypath”的项目
我从Eclipse迁移到android studio 0.5.8,将项目导入到android studio后,我遇到了错误Project with path ':progressfragment' could not be found in root project 'project_name'. 项目结构: 图书馆 完整结构(编辑2): Gradle.build: apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':progressfragment') compile project(':viewpagerindicatorlibrary') compile project(':ZBarScannerActivity') compile project(':google-play-services_lib') compile project(':SwitchCompatLibrary') compile project(':actionbarsherlock') compile project(':librarymultichoice') } buildscript { repositories { mavenCentral() } …

24
房间持久性:错误:实体和Pojos必须具有可用的公共构造函数
我正在将一个项目转换为Kotlin,并且试图将我的模型(也是我的实体)变成一个数据类,我打算使用Moshi来转换来自API的JSON响应 @Entity(tableName = "movies") data class MovieKt( @PrimaryKey var id : Int, var title: String, var overview: String, var poster_path: String, var backdrop_path: String, var release_date: String, var vote_average: Double, var isFavorite: Int ) 我无法构建导致以下错误的应用 实体和Pojos必须具有可用的公共构造函数。您可以有一个空的构造函数或一个其参数与字段匹配的构造函数(按名称和类型)。找不到字段的设置器。 我发现的例子离这个不远 关于如何解决的想法?

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.