小编tia*_*ato的帖子

CameraUpdateFactory.newLatLngBounds始终无法正常工作

我有一些问题需要在Android谷歌地图上移动相机.

我有这个功能:

protected void centralizeMapToBounds(final LatLng southwest, final LatLng northeast, final LatLng taxi) {
    final int padding = 30;

    Location loc1 = new Location("");
    loc1.setLatitude(southwest.latitude);
    loc1.setLongitude(southwest.longitude);

    Location loc2 = new Location("");
    loc2.setLatitude(northeast.latitude);
    loc2.setLongitude(northeast.longitude);

    Location loc3 = new Location("");
    loc3.setLatitude(taxi.latitude);
    loc3.setLongitude(taxi.longitude);

    float d1 = loc1.distanceTo(loc2);
    float d2 = loc1.distanceTo(loc3);
    float d3 = loc2.distanceTo(loc3);

    LatLngBounds bounds = null;
    try {


        if(d1 > d2){
            if(d1 > d3){
                ICabDebug.i(TAG, "Maior distancia d1: " + d1);
                if(southwest.latitude > northeast.latitude)
                    bounds = new LatLngBounds(southwest,northeast);
                else
                    bounds …
Run Code Online (Sandbox Code Playgroud)

android google-maps

4
推荐指数
1
解决办法
5574
查看次数

AndroidAnnotations 和 Dagger 2

我正在阅读有关依赖注入的内容,发现 2 个引起我注意的库,AndroidAnnotations 和 Dagger 2。我看到的是 AA 有很多功能,包括 DI,但大多数开发人员都使用 Dagger 2 进行 DI。

我想知道 DI 与 AA 和 DI 与 Dagger 2 有什么区别?如果我使用 AA 就意味着我不需要 Dagger 2?

我找不到太多关于 DI 与 AA 以及与其他库的比较的信息。

任何信息都会有很大帮助。

android dependency-injection android-annotations dagger-2

4
推荐指数
1
解决办法
983
查看次数

appcompat-v7依赖返回错误

我试图从android studio 0.8.1(beta)上的eclipso导入项目,并且所有事情都正确但appcompat-v7 attr上的错误相同.我有以下gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

defaultConfig {
    applicationId "package"
    minSdkVersion 10
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile project(":facebook")
    compile project(":socketConnetion")
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.0.+'
    compile 'com.android.support:support-v4:20.+'
    compile 'com.google.android.gms:play-services:+'
}
Run Code Online (Sandbox Code Playgroud)

当我同步gradle时,我不断收到错误:

/Users/tiag`omissiato/AndroidstudioProjects/Get/build/intermediates/exploded-aar/com.android.support/appcompat-v7/19.0.1/res/values/values.xml
Error:(432, 21) No resource found that matches the given name: attr 'dropdownListPreferredItemHeight'.
Error:(434, 21) No resource found that matches the given name: …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat android-studio

1
推荐指数
1
解决办法
1007
查看次数