gmap3:当我通过jquery更新它时,谷歌地图不是中心

时间:2015-08-23 01:56:33

标签: jquery google-maps jquery-gmap3

嗨,这段代码适合我。

package inncharge.poy.madrigal.innchargev1.adapters;

import android.content.ClipData;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Collections;
import java.util.List;

import inncharge.poy.madrigal.innchargev1.R;
import inncharge.poy.madrigal.innchargev1.fragments.FragmentMeal;
import inncharge.poy.madrigal.innchargev1.pojo.Contact;
import inncharge.poy.madrigal.innchargev1.pojo.Information;

/**
 * Created by Madrigal on 7/18/2015.
 */
public class VivzAdapter extends RecyclerView.Adapter<VivzAdapter.MyViewHolder> {

    private Context context;
    private final LayoutInflater inflater;
    List<Contact> data = Collections.emptyList();

    public VivzAdapter(Context context, List<Contact> data){

        this.context=context;
        inflater = LayoutInflater.from(context);
        this.data=data;

    }

    public void delete(int position){
        data.remove(position);
        notifyItemRemoved(position);
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.custom_row, parent, false);
        Log.d("VIVZ","onCreateHolder called ");
        MyViewHolder holder = new MyViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {

        Contact current = data.get(position);
        Log.d("VIVZ", "onBindViewHolder called " + position);
        holder.itemId.setText(String.valueOf(current.getId()));
        holder.title.setText(current.getName());
        holder.email.setText(current.getEmail());

    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        public TextView title;
        public TextView email;
        public TextView itemId;


        public MyViewHolder(View itemView) {
            super(itemView);
            title = (TextView) itemView.findViewById(R.id.listTextName);
            email = (TextView) itemView.findViewById(R.id.listTextUname);
            itemId = (TextView) itemView.findViewById(R.id.listTextId);
        }

        @Override
        public void onClick(View v) {


        }

    }

}

地图将在法国国家/地区放大5。

但是当使用这个jquery代码再次运行它时:

setMap("France",5);
function setMap(iaddress,izoom){
    $("#test").gmap3({
        marker:{
          address: iaddress
        },
        map:{
          options:{
            zoom: izoom
          }
        }
    });
}

它有效,但是&#34; Haltern am See,Weseler Str。 151&#34;不是谷歌地图的中心!该中心位于法国的某个地方(中心是最后一个地址,但放大工作)

例如,如果我去&#34; Haltern am See,Weseler Str。 151&#34; manualy。该位置标记。

如何自动进入&#34; Haltern am See,Weseler Str。 151&#34;当我更新地图?

0 个答案:

没有答案