小编Víc*_*tín的帖子

有人知道如何将GMap Static JSON转换为HTML网址吗?

我已经从snazzymaps.com下载了一个示例样式的地图.我尝试转换为http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=512x512&zoom=15&​​center=Chicago这样的网址,但我做得不好.我正试图改变下一个例子:

示例Google Map样式静态

JSON看起来像这样:

styles: [

{"featureType":"poi","stylers":[{"visibility":"off"}]},{"stylers":[{"saturation":-70},{"lightness":37},{"gamma":1.15}]},{"elementType":"labels","stylers":[{"gamma":0.26},{"visibility":"off"}]},

{"featureType":"road","stylers":[{"lightness":0},{"saturation":0},{"hue":"#ffffff"},{"gamma":0}]},

{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"visibility":"off"}]},

{"featureType":"road.arterial","elementType":"geometry","stylers":[{"lightness":20}]},

{"featureType":"road.highway","elementType":"geometry","stylers":[{"lightness":50},{"saturation":0},{"hue":"#ffffff"}]},

{"featureType":"administrative.province","stylers":[{"visibility":"on"},{"lightness":-50}]},

{"featureType":"administrative.province","elementType":"labels.text.stroke","stylers":[{"visibility":"off"}]},

{"featureType":"administrative.province","elementType":"labels.text","stylers":[{"lightness":20}]}
Run Code Online (Sandbox Code Playgroud)

我改变了下一个,但它不起作用,我做错了!! :S

http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=512x512&zoom=15&center=Chicago&format=png&style=feature:poi%7Cvisibility:off%7Csaturation:-70%7Clightness:37%7Cgamma:1.15%7Celement:labels%7Cgamma:0.26%7Cvisibility:off&style=road%7Clightness:0%7Csaturation:0%7Chue:#ffffff%7Cgamma:0&style=road%7Celement:labels.text.stroke%7Cvisibility:off&style=road.arterial%7Celement:geometry%7Clightness:20&style=road.highway%7Celement:geometry%7Clightness:50%7Csaturation:0%7Chue:#ffffff&style=administrative.province%7Cvisibility:on%7Clightness:-50&style=administrative.province%7Celement:labels.text.stroke%7Cvisibility:off&style=administrative.province%7Celement:labels.text%7Clightness:20
Run Code Online (Sandbox Code Playgroud)

如果有人可以给我一个建议,我将非常感激.

url json google-maps google-maps-static-api google-maps-styling

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

如何使用翻新查询URL中间的参数

我正在阅读有关Retrofit 1&2的文章和文档。我有下一个源代码可以从用户那里获取存储库。

@GET("users/{user}/repos")
Call<List<GithubRepo>> getRepos(@Path("user") String user);
Run Code Online (Sandbox Code Playgroud)

在retrofit2中,我看到现在我们需要使用@Query更改@Path,但是我不知道using方法是否相同。就像下一个一样,还是我需要更改更多内容?

@GET("users/{user}/repos")
Call<List<GithubRepo>> getRepos(@Query("user") String user);
Run Code Online (Sandbox Code Playgroud)

谢谢

android param path retrofit2

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

如何在片段方法中获取实现的回调的上下文

我已经为Fragment定义了下一个标题:

public class AllVideosFragment extends Fragment implements AutomaticCallback{
Run Code Online (Sandbox Code Playgroud)

在此片段的内部,我有下一个处理微调器的功能:

// Listener called when spinner item selected
        spinnerLanguages.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parentView, View v, int position, long id) {
                // Get selected row data to show on screen
                String language = ((TextView) v.findViewById(R.id.tvSpinnerRow)).getText().toString();

                if(language.equals(getString(R.string.str_en)))
                    Hawk.put(Config.TV_LANGUAGE, "en");
                if(language.equals(getString(R.string.str_es)))
                    Hawk.put(Config.TV_LANGUAGE, "es");

                //We need to retrive data again
                new AutomaticRequest().getLives(String.valueOf(Hawk.get(Config.TV_LANGUAGE)), **CONTEXT OF THE CALLBACK**);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parentView) {
                // your code here
            }

        });
Run Code Online (Sandbox Code Playgroud)

如果在微调柄方法之外使用该方法,则可以使用“ this”,但在内部我不知道需要使用什么。

new AutomaticRequest().getLives(String.valueOf(Hawk.get(Config.TV_LANGUAGE)), …
Run Code Online (Sandbox Code Playgroud)

android android-context android-fragments

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

更改自定义Toast中的文本和图标?

当我尝试显示自定义吐司(带图标和消息)时,我遇到了一些问题.这是代码.

private void makeToast(String text, int icon) {

        LayoutInflater inflater = getLayoutInflater();
        View layout = inflater.inflate(R.layout.custom_toast,(ViewGroup) findViewById(R.id.message));
        ((TextView) layout.findViewById(R.id.message)).setText(text);

        layout = inflater.inflate(R.layout.custom_toast,(ViewGroup) findViewById(R.id.icon));

        // 0 - Exclamation, 1 - Noow icon
        if(icon == 0){
            ((ImageView) layout.findViewById(R.id.icon)).setImageResource(R.drawable.exclamation);
        }else if(icon == 1){
            ((ImageView) layout.findViewById(R.id.icon)).setImageResource(R.drawable.nicon);
        }


        Toast toast = new Toast(getBaseContext());
        toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(layout);
        toast.show();
    }
Run Code Online (Sandbox Code Playgroud)

我想在第二个参数为0或1时更改图标和消息.我知道问题出在第二个布局的调用中,但我不知道如何解决它.

谢谢.

编辑:

我从AsyncTask中的onPostExecute调用此方法.我忘了告诉这件事.

Thread [<11> AsyncTask #1] (Suspended (exception RuntimeException)) 
    ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: not available 
    ThreadPoolExecutor$Worker.run() line: not available 
    Thread.run() line: not available    
Run Code Online (Sandbox Code Playgroud)

编辑2:

@Override
protected void onProgressUpdate(Void... …
Run Code Online (Sandbox Code Playgroud)

android toast

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

是否有任何方法可以创建另一个具有两个arraylists的共同值的arraylist?

也就是说,如果我有下一个:

ArrayList<Integer> array1 = new ArrayList<Integer>();
ArrayList<Integer> array2 = new ArrayList<Integer>();

array1 ==> (1,11,12,13,14,15,16,17,18)
array2 ==> (1,17,18)
Run Code Online (Sandbox Code Playgroud)

是否有任何方法可以创建具有共同值的另一个arraylist?

java compare arraylist

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

为什么 setVisibility 在 Fragment/FrameLayout 上不起作用

我有一个带有不确定进度条的布局,当超过 3 秒时,我想隐藏这个进度条并显示一个 web 视图,但由于某种原因它不起作用。

这是我的 XML:

<FrameLayout 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:id="@+id/fl_register_oauth"
    tools:context=".fragments.RegisterFragment"
    android:background="@color/f_yellow">

    <LinearLayout 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"
        tools:context=".MainActivity$PlaceholderFragment"
        android:gravity="center"
        android:layout_gravity="center"
        android:orientation="vertical">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/ll_pbar"
            android:gravity="center"
            android:visibility="gone">

        </LinearLayout>

        <ProgressBar
            android:id="@+id/progressBar"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminateDrawable="@drawable/progress" />

        <WebView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/webView"
            android:visibility="gone"
            android:layout_gravity="center" />

    </LinearLayout>

    <FrameLayout
        android:id="@+id/FlashBarLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_marginBottom="72dp">
        <!-- flash bar content -->
    </FrameLayout>

</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的片段源代码。

public class RegisterFragment extends Fragment {

...

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate …
Run Code Online (Sandbox Code Playgroud)

android visibility android-fragments android-framelayout

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