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 […]

通过Eclipse错误运行Gradle项目“system can not find System Java Compiler”

当我通过Eclipse运行Gradle项目时,出现以下错误。 系统找不到系统Java编译器。 确保你已经安装了一个JDK(不仅仅是一个JRE),并且把你的JAVA_HOME系统variablesconfiguration为指向根目录。 无法使用Gradle安装“C:\ gradle-1.2-all \ gradle-1.2”来执行构build。 但是我已经安装了JDK 1.7并设置了JAVA_HOME环境variables。

在iPhone中以编程方式从另一个应用打开设置应用

如果gps在iPhone中未启用,我必须从我的应用程序打开设置应用程序。 我已经使用了下面的代码。 它在iOS模拟器中运行良好,但在iPhone中不起作用。 请问这个代码有没有问题? if (![CLLocationManager locationServicesEnabled]) { int (*openApp)(CFStringRef, Boolean); void *hndl = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices"); openApp = (int(*)(CFStringRef, Boolean)) dlsym(hndl, "SBSLaunchApplicationWithIdentifier"); openApp(CFSTR("com.apple.Preferences"), FALSE); dlclose(hndl); }

检测后退button,但不要closuresdialogfragment

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

NSUInteger不应该在格式string中使用?

这是我的代码在所有荣耀: [NSString stringWithFormat:@"Total Properties: %d", (int)[inArray count]]; 这让我一个Xcode 5.1的警告: Values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long' instead 好,所以我很困惑。 该值实际上是一个32位整数,并将其转换为32位整数。 那么这是什么NSUInteger它抱怨(我假设伯爵),为什么不能修复它?

如何将一个整数分成两个加数?

我需要将一个整数分成两个数字。 就像二分之一,但我只想要整数组件,如: 6 = 3 and 3 7 = 4 and 3 我尝试了以下,但我不知道它是最好的解决scheme。 var number = 7; var part1 = 0; var part2 = 0; if((number % 2) == 0) { part1 = number / 2; part2 = number / 2; } else { part1 = parseInt((number / 2) + 1); part2 = parseInt(number / […]

Google街景视图url

您好,我有一个属性的地址,我的应用程序可以启动浏览器去http://maps.google.com?q=searchStringHere 。 如果find了一个好的匹配,它会直接在那里。 有没有什么我可以附加到的url,使其切换到街景没有确切的坐标? 我不想编码任何JavaScript或Flash。

获取当前的URL / URI,没有$ _GETvariables

Yii如何获取当前页面的URL。 例如: http://www.yoursite.com/your_yii_application/?lg=pl&id=15 但不包括$GET_['lg'] (手动parsingstring)? 我的意思是,我正在寻找类似于Yii::app()->requestUrl / Chtml::link()方法的东西,用于返回URL减去一些$_GETvariables。 编辑 :当前解决scheme: unset $_GET['lg']; echo Yii::app()->createUrl( Yii::app()->controller->getId().'/'.Yii::app()->controller->getAction()->getId() , $_GET );

Xcode:拖动项目到工作区在Project Navigator中显示微小的.xcodeproj文件。 怎么了?

设置 : Xcode 4.3.1(或5.x) OS X 10.7.3 我已经使用此设置在两个单独的新型Mac上再现了此问题。 步骤 : 创build一个新的Mac“cocoa应用程序”Xcode项目。 File > New > Project…命名为“MyApp”。 创build一个新的工作区: File > New > Workspace…命名为“MySuite”。 将Finder中的MyApp.xcodeproj文件拖到“MySuite”工作区的Project Navigator中。 预期 : “MySuite”工作区的项目导航器现在应该显示“源”,“目标”等的“MyApp”的完整子项目 。 实际 : “MySuite”工作区项目导航器在Project Navigator中显示一个小小的MyApp.xcodeproj项目。 (见截图) 拖动: 结果: 我在做什么错误试图将项目添加到工作区?

Qt5未find目标条件

我只是更新到OS X Mavericks的命令行工具的最新版本,现在编译我的(以前工作)的代码,它会引发以下错误 > clang: warning: no such sysroot directory: > '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk' > In file included from ../QtOpenGL/Main.cpp:1: In file included from > ../../Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QApplication:1: > In file included from > ../../Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qapplication.h:45: > In file included from > /Users/BB/Qt/5.3/clang_64/lib/QtCore.framework/Headers/qcoreapplication.h:45: > In file included from > /Users/BB/Qt/5.3/clang_64/lib/QtCore.framework/Headers/qglobal.h:76: > /Users/BB/Qt/5.3/clang_64/lib/QtCore.framework/Headers/qsystemdetection.h:196:12: > fatal error: 'TargetConditionals.h' file not found > […]