小编Mat*_*tej的帖子

LocationManager requestLocationUpdates minTime 或 minDistance

我正在使用 AndroidLocationManager及其方法,requestLocationUpdates如下所示:

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 10, this);
Run Code Online (Sandbox Code Playgroud)

我发现位置更新必须满足 minTime 和 minDistance 的条件,但我需要每 3 秒或 10 米更新一次。

我试图提出 2 个这样的请求:

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 0, this);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 10, this);
Run Code Online (Sandbox Code Playgroud)

但它不起作用,我只使用此代码每 10 米更新一次,而不是每 3 秒更新一次。

如果这很重要,我正在使用 API19。

java gps android android-4.4-kitkat android-gps

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

当小吃栏出现时,使ScrollView变小

我刚开始在我的Android应用程序中使用Snackbar而且我无法让ScrollView变小,因为它不会覆盖ScrollView内部的任何内容.

这是我的活动的xml布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    android:id="@+id/container"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBackground"
    tools:context="com.example.MainActivity">

    <ScrollView
        android:id="@+id/scrollview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginTop="16dp"
            android:orientation="vertical">

            [LOT OF ELEMENTS IN HERE]

        </LinearLayout>
    </ScrollView>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

我在StackOverflow上尝试了很多解决方案,但是对我来说还没有任何效果.

android android-design-library android-snackbar

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