Tag: android

Gradle错误:任务执行失败':app:processDebugGoogleServices'

我正在关注这个链接,在我的android应用程序中集成G​​ooglelogin。 https://developers.google.com/identity/sign-in/android/start-integrating正如上面给出的页面给出的,我们必须包含依赖 compile 'com.google.android.gms:play-services-auth:8.3.0' 在应用程序级build.gradle文件,但这样做和build设项目的错误来说 Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict. 的build.gradle(模块:APP) apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.brainbreaker.socialbuttons" minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies […]

Android ScrollView不是从顶部开始,而是在GridView的开始

我有一个ScrollView的问题,里面有一个个性化的GridView和其他视图。第一次启动Activity时,ScrollView从顶部开始,但是如果我在其他时间访问Activity,ScrollView会在开始时开始GridView.I使用了在这个链接中find的类ExpandableHeightGridView用于我的GridView。 活动布局的xml代码是这样的: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollViewLuogo" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView1" android:layout_width="150dp" android:layout_height="100dp" android:layout_marginLeft="14dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:adjustViewBounds="true" android:maxHeight="200dp" android:maxWidth="200dp" android:scaleType="fitXY" android:src="@android:drawable/ic_menu_gallery" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="vertical" > <TextView android:id="@+id/nomeTVActivityLuogo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:textSize="17sp" android:textColor="#005788" /> <TextView android:id="@+id/indirizzoTVActivityLuogo" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> <LinearLayout […]

检测后退button,但不要closuresdialogfragment

我有一个浮动对话框的对话框,其中包含一个特殊的键盘,当用户按下EditText字段(正常IME停止显示)时popup。 当用户按下后退button(就像正常的IME服务一样),但是对话框保持可见状态时,我希望键盘被解除(可见性= GONE)。 然而,就我在SO和其他地方相当广泛的阅读中所看到的,似乎没有办法做到这一点。 如果我将对话框设置为不可取消,那么我不会通过onCancel()或onDismiss()得到通知,因为对话框是不可取消的。 如果我将对话框设置为可取消,则会收到通知,但对话框将被解除。 我无法将onKeyListener附加到片段中的对话框,因为它被系统replace,因此片段可以处理对话框的生命周期。 有没有办法做到这一点? 或者为了碎片系统的目的,可以访问关键事件的检测function?

有没有办法来禁用/编辑列表视图在其边缘的衰落?

诸如ListView之类的可滚动视图沿着沿着该方向具有更多内容的边缘淡出内容。 我怎么能把这个消失? 我知道你可以改变cacheColorHint在这里讨论: http : //developer.android.com/resources/articles/listview-backgrounds.html但是这不是我所期待的,并不会实现我所期待的案件。 我想完全禁用淡入淡出,或者能够减小它的大小和/或透明度。 这可能吗?

SimpleDateFormat返回24小时date:如何获得12小时date?

我需要毫秒的当前时间,然后以12小时的格式存储它,但是用这段代码我得到24小时格式化的时间。 long timeInMillis = System.currentTimeMillis(); Calendar cal1 = Calendar.getInstance(); cal1.setTimeInMillis(timeInMillis); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy HH:mm:ss a"); dateforrow = dateFormat.format(cal1.getTime()); 有人可以build议修改,以获得预期的结果吗?

ImageView填充父宽度或高度,但保持宽高比

我有一个方形图像(虽然这个问题也适用于矩形图像)。 我希望尽可能大地展示图片,如有必要可以展开图片,以填充父母,同时保持高宽比。 图像比ImageView小。 问题是,我无法拉伸图像,并“匹配”ImageView的高度和宽度。 这是我的XML布局文件: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp"> <ImageView android:id="@+id/image" android:layout_width="fill_parent" android:layout_height="fill_parent" android:adjustViewBounds="true" android:scaleType="fitCenter" android:layout_marginTop="10dp"/> <TextView android:id="@+id/name" android:layout_below="@id/image" android:layout_alignLeft="@id/image" android:layout_marginTop="20dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dp"/> <TextView android:id="@+id/name2" android:layout_below="@id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="14dp"/> </RelativeLayout> 我已经使用fill_parent , wrap_content和多个缩放types的许多组合: fitCenter , fitStart , fitEnd , centerInside ,它们都以正确的高宽比绘制图像,但是没有一个实际缩放图像和ImageView本身 ,导致TextViews被一路推下屏幕,ImageView里面的空白,图像没有缩放或图像被裁剪。 我不能完全确定这个合适的组合。

Android:按下button退出应用程序

在我的应用程序,我想退出从应用程序时按下button,这是我的代码: @Override public void onBackPressed() { new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Exit") .setMessage("Are you sure you want to exit?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).setNegativeButton("No", null).show(); } 它的工作是正确的,但是当我退出应用程序它不完全退出,并显示与我的应用程序标识的空白页面,当我再次按下button退出应用程序,我该如何解决? 编辑: 我使用这个代码而不是上面,但我的应用程序完全退出,但我希望它在后台运行,并不完全退出,我该怎么做呢? @Override public void onBackPressed() { new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Exit") .setMessage("Are you sure?") .setPositiveButton("yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int […]

如何捕获SearchView的清除button点击?

如何通过单击右侧的Xbutton捕获用户单击清除SearchView文本的事件 我已经捕获了onQueryTextChange事件,但是,这是为任何文本更改不Xbutton

在视图中使用淡入淡出animation

我想要一个最初是不可见的View ,当我按下一个button时,它会变成可见的,在animation中淡入淡出。 我正在使用AlphaAnimation的衰落效果。 问题是,如果我使视图不可见,animation将无法看到。 非常感谢, 的Gratzi

ADB安装失败INSTALL_FAILED_TEST_ONLY

我在安装apk到我的设备时遇到问题。 adb install <.apk> 使用上述命令返回以下内容: 5413 KB / s(99747字节在0.017s)pkg:/data/local/tmp/AppClient.TestOnly.App3.apk失败[INSTALL_FAILED_TEST_ONLY] 任何想法可能会导致这个问题? 它绝对认可这个设备。 这可能是apk的问题吗?