30f863e1 by chiangbt

更新了高德检索POI

1 parent aeb0af84
...@@ -6,7 +6,9 @@ import android.support.design.widget.FloatingActionButton; ...@@ -6,7 +6,9 @@ import android.support.design.widget.FloatingActionButton;
6 import android.support.v7.app.AppCompatActivity; 6 import android.support.v7.app.AppCompatActivity;
7 import android.os.Bundle; 7 import android.os.Bundle;
8 import android.util.Log; 8 import android.util.Log;
9 import android.view.LayoutInflater;
9 import android.view.View; 10 import android.view.View;
11 import android.widget.TextView;
10 import android.widget.Toast; 12 import android.widget.Toast;
11 13
12 import com.androidnetworking.AndroidNetworking; 14 import com.androidnetworking.AndroidNetworking;
...@@ -14,6 +16,7 @@ import com.androidnetworking.error.ANError; ...@@ -14,6 +16,7 @@ import com.androidnetworking.error.ANError;
14 import com.androidnetworking.interfaces.JSONObjectRequestListener; 16 import com.androidnetworking.interfaces.JSONObjectRequestListener;
15 import com.arlib.floatingsearchview.FloatingSearchView; 17 import com.arlib.floatingsearchview.FloatingSearchView;
16 import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; 18 import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion;
19 import com.esri.android.map.Callout;
17 import com.esri.android.map.GraphicsLayer; 20 import com.esri.android.map.GraphicsLayer;
18 import com.esri.android.map.LocationDisplayManager; 21 import com.esri.android.map.LocationDisplayManager;
19 import com.esri.android.map.MapView; 22 import com.esri.android.map.MapView;
...@@ -158,6 +161,22 @@ public class GoogleMapActivity extends AppCompatActivity { ...@@ -158,6 +161,22 @@ public class GoogleMapActivity extends AppCompatActivity {
158 161
159 graphicsLayer.addGraphic(new Graphic(GISHelper.lonLat2Mercator(poipt), 162 graphicsLayer.addGraphic(new Graphic(GISHelper.lonLat2Mercator(poipt),
160 new PictureMarkerSymbol(getResources().getDrawable(R.mipmap.locator)).setOffsetY(16))); 163 new PictureMarkerSymbol(getResources().getDrawable(R.mipmap.locator)).setOffsetY(16)));
164
165 LayoutInflater inflater = LayoutInflater.from(GoogleMapActivity.this);
166 View view = inflater.inflate(R.layout.callout_layout, null);
167 // 设置Callout属性
168 TextView title = (TextView)view.findViewById(R.id.title);
169 TextView content = (TextView)view.findViewById(R.id.content);
170 title.setText("名称:" + colorSuggestion.getName());
171 content.setText("地址:" + colorSuggestion.getAddress());
172 // // 获取Callout
173 Callout callout = mapView.getCallout();
174 // // 设置Callout样式
175 // callout.setStyle(R.xml.calloutlayout);
176 // 设置锚点偏移量
177 callout.setOffset(0, -5);
178 // 显示Callout
179 callout.show(GISHelper.lonLat2Mercator(poipt), view);
161 } 180 }
162 181
163 @Override 182 @Override
......
...@@ -75,6 +75,10 @@ public class POISuggestion implements SearchSuggestion { ...@@ -75,6 +75,10 @@ public class POISuggestion implements SearchSuggestion {
75 } 75 }
76 }; 76 };
77 77
78 public String getName() {
79 return name;
80 }
81
78 public String getAddress() { 82 public String getAddress() {
79 return address; 83 return address;
80 } 84 }
......
1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:orientation="horizontal" >
6
7 <LinearLayout
8 android:layout_width="150dp"
9 android:layout_height="wrap_content"
10 android:orientation="vertical" >
11
12 <TextView
13 android:id="@+id/title"
14 android:layout_width="wrap_content"
15 android:layout_height="wrap_content"
16 android:text=""
17 android:textSize="12sp"/>
18 <TextView
19 android:id="@+id/content"
20 android:layout_width="wrap_content"
21 android:layout_height="wrap_content"
22 android:text=""
23 android:textSize="12sp"/>
24
25 </LinearLayout>
26
27 </LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <resources>
3 <calloutlayout>
4 titleTextColor="#000000" <!-- 标题颜色 -->
5 titleTextSize = 10; <!-- 标题文字大小 -->
6 titleTextStyle = 0; <!-- 字体样式 -->
7 titleTextTypeFace = 0; <!-- 字体类型设置 -->
8 backgroundColor="#ffffff" <!-- Callout背景颜色 -->
9 backgroundAlpha="255" <!-- Callout透明度 -->
10 frameColor="#000000" <!-- 边框颜色 -->
11 flat="true" <!-- true表示2D图形,false表示3D图形 -->
12 style.getCornerCurve()="0" <!-- 边框的角的圆润程度 -->
13 anchor="5" <!-- 锚点的位置-->
14 </calloutlayout>
15 </resources>
...\ No newline at end of file ...\ No newline at end of file