import java.util.List;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BaiduMap.OnMapStatusChangeListener;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationConfiguration;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.search.core.PoiInfo;
import com.baidu.mapapi.search.core.SearchResult;
import com.baidu.mapapi.search.geocode.GeoCodeResult;
import com.baidu.mapapi.search.geocode.GeoCoder;
import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener;
import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption;
import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult;
import com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener;
import com.baidu.mapapi.search.poi.PoiCitySearchOption;
import com.baidu.mapapi.search.poi.PoiDetailResult;
import com.baidu.mapapi.search.poi.PoiResult;
import com.baidu.mapapi.search.poi.PoiSearch;
import com.baidu.mapapi.search.sug.OnGetSuggestionResultListener;
import com.baidu.mapapi.search.sug.SuggestionResult;
import com.baidu.mapapi.search.sug.SuggestionSearch;
import com.baidu.mapapi.search.sug.SuggestionSearchOption;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
public class MoreAddressActivity extends Activity implements OnClickListener, OnGetSuggestionResultListener,
OnMapStatusChangeListener, BDLocationListener, OnGetGeoCoderResultListener, TextWatcher {
private ImageView iv_left;
protected static final String TAG = "MoreAddressActivity";
protected static final int REQUEST_OK = 0;
private ListView lv_near_address;
private SuggestionSearch mSuggestionSearch = null;
private BaiduMap mBaiduMap = null;
private double latitude;
private double longitude;
/**
* 搜索关键字输入窗口
*/
private AutoCompleteTextView keyWorldsView = null;
private ArrayAdapter<String> sugAdapter = null;
private int load_Index = 0;
private PoiSearchAdapter adapter;
private MapView map;
private MyLocationConfiguration.LocationMode mCurrentMode;
private LocationClient mLocClient;
private GeoCoder geoCoder;
private String city;
private boolean isFirstLoc = true;
private LatLng locationLatLng;
private EditText searchAddress;
private List<PoiInfo> poiInfos;
private ListView searchPois;
private ImageView mImg_load_animation;
private long startTime;
private long stopTome;
private TextView mTv_net;
private RelativeLayout mRl_gps;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_more_address);
initData();
startTime = System.currentTimeMillis();
// setStatusBarColor();
}
private void initData() {
///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
searchAddress = (EditText) findViewById(R.id.main_search_address);
searchPois = (ListView) findViewById(R.id.main_search_pois);
mImg_load_animation = (ImageView) findViewById(R.id.img_load_animation);
mTv_net = (TextView) findViewById(R.id.tv_net);
mRl_gps = (RelativeLayout) findViewById(R.id.rl_gps);
mRl_gps.setClickable(true);
searchAddress.addTextChangedListener(this);
searchPois.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
searchPois.setVisibility(View.GONE);
if (poiInfos != null) {
if (poiInfos.get(position) != null) {
LatLng location = poiInfos.get(position).location;
if (location != null) {
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLngZoom(location, 18);
mBaiduMap.animateMapStatus(msu);
}
}
}
}
});
///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
map = (MapView) findViewById(R.id.map);
mBaiduMap = map.getMap();
MapStatus mapStatus = new MapStatus.Builder().zoom(15).build();
MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus);
mBaiduMap.setMapStatus(mMapStatusUpdate);
// 地图状态改变相关监听
mBaiduMap.setOnMapStatusChangeListener(this);
// 开启定位图层
mBaiduMap.setMyLocationEnabled(true);
// 定位图层显示方式
mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, null));
mLocClient = new LocationClient(this);
// 注册定位监听
mLocClient.registerLocationListener(this);
// 定位选项
LocationClientOption option = new LocationClientOption();
/**
* coorType - 取值有3个: 返回国测局经纬度坐标系:gcj02 返回百度墨卡托坐标系 :bd09 返回百度经纬度坐标系
* :bd09ll
*/
option.setCoorType("bd09ll");
// 设置是否需要地址信息,默认为无地址
option.setIsNeedAddress(true);
// 设置是否需要返回位置语义化信息,可以在BDLocation.getLocationDescribe()中得到数据,ex:"在天安门附近",
// 可以用作地址信息的补充
option.setIsNeedLocationDescribe(true);
// 设置是否需要返回位置POI信息,可以在BDLocation.getPoiList()中得到数据
option.setIsNeedLocationPoiList(true);
/**
* 设置定位模式 Battery_Saving 低功耗模式 Device_Sensors 仅设备(Gps)模式 Hight_Accuracy
* 高精度模式
/ */
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
// 设置是否打开gps进行定位
option.setOpenGps(true);
// 设置扫描间隔,单位是毫秒 当<1000(1s)时,定时定位无效
option.setScanSpan(1000);
// 设置 LocationClientOption
mLocClient.setLocOption(option);
// 开始定位
mLocClient.start();
lv_near_address = (ListView) findViewById(R.id.lv_near_address);
// // 初始化搜索模块,注册搜索事件监听
// mSuggestionSearch = SuggestionSearch.newInstance();
// mSuggestionSearch.setOnGetSuggestionResultListener(this);
// keyWorldsView = (AutoCompleteTextView) findViewById(R.id.et_search);
// sugAdapter = new ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line);
// keyWorldsView.setAdapter(sugAdapter);
// /**
// * 当输入关键字变化时,动态更新建议列表
// */
// keyWorldsView.addTextChangedListener(new TextWatcher() {
//
// @Override
// public void afterTextChanged(Editable arg0) {
// }
//
// @Override
// public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
//
// }
//
// @Override
// public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
// if (cs.length() <= 0) {
// return;
// }
// String city = "杭州";
// String cityone = "安徽省";
// /**
// * 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新
// */
// mSuggestionSearch.requestSuggestion((new SuggestionSearchOption()).keyword(cs.toString()).city(city));
// mSuggestionSearch.requestSuggestion((new SuggestionSearchOption()).keyword(cs.toString()).city(cityone));
// }
// });
//
// keyWorldsView.setOnItemClickListener(new OnItemClickListener() {
//
// @Override
// public void onItemClick(AdapterView> arg0, View arg1, int arg2, long arg3) {
// String address = arg0.getItemAtPosition(arg2).toString();
// Log.i(TAG, "address.toString()" + address.toString());
// Intent intentAddress = new Intent();
// intentAddress.putExtra("selectAddress", keyWorldsView.getText().toString());
// setResult(RESULT_OK, intentAddress);
// // finish();
// }
// });
iv_left = (ImageView) findViewById(R.id.iv_left);
iv_left.setOnClickListener(this);
}
/*
* 接受周边地理位置结果
*
* @param poiResult
*/
@Override
protected void onDestroy() {
super.onDestroy();
mBaiduMap.setMyLocationEnabled(false);
map.onDestroy();
if (geoCoder != null) {
geoCoder.destroy();
}
map = null;
if (mSuggestionSearch != null) {
mSuggestionSearch.destroy();
mSuggestionSearch = null;
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_left:
finish();
break;
default:
break;
}
}
public void onResume() {
super.onResume();
map.onResume();
// if (getIntent().getStringExtra("latitude") != null &&
// (!"".equals(getIntent().getStringExtra("latitude")))) {
// latitude = Double.parseDouble(getIntent().getStringExtra("latitude"));
// longitude = Double.parseDouble(getIntent().getStringExtra("longitude"));
// TtelifeLog.i(TAG, "latitude" + latitude);
// }
// MobclickAgent.onResume(this);
}
public void onPause() {
super.onPause();
map.onPause();
}
// private void setStatusBarColor() {
// Window window = getWindow();
// WindowManager.LayoutParams params = getWindow().getAttributes();
// params.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
// window.setAttributes(params);
// SystemBarTintManager tintManager = new SystemBarTintManager(this);
// tintManager.setStatusBarTintEnabled(true);
// tintManager.setTintColor(getResources().getColor(R.color.tab));
// }
//
// public void onGetPoiDetailResult(PoiDetailResult result) {
// if (result.error != SearchResult.ERRORNO.NO_ERROR) {
// Toast.makeText(MoreAddressActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT).show();
// } else {
// Toast.makeText(MoreAddressActivity.this, result.getName() + ": " + result.getAddress(), Toast.LENGTH_SHORT)
// .show();
// }
// }
@Override
public void onGetSuggestionResult(SuggestionResult res) {
if (res == null || res.getAllSuggestions() == null) {
return;
}
sugAdapter.clear();
for (SuggestionResult.SuggestionInfo info : res.getAllSuggestions()) {
if (info.key != null)
sugAdapter.add(info.key + " " + info.city + info.district);
}
sugAdapter.notifyDataSetChanged();
}
///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
// String s1 = searchAddress.getText().toString();
// boolean empty = s1.isEmpty();
// if (empty) {
// searchPois.setVisibility(View.GONE);
// }
if (s.length() == 0 || "".equals(s.toString())) {
searchPois.setVisibility(View.GONE);
} else {
searchPois.setVisibility(View.VISIBLE);
// 创建PoiSearch实例
PoiSearch poiSearch = PoiSearch.newInstance();
// 城市内检索
PoiCitySearchOption poiCitySearchOption = new PoiCitySearchOption();
// 关键字
poiCitySearchOption.keyword(s.toString());
// 城市
poiCitySearchOption.city(city);
// 设置每页容量,默认为每页10条
poiCitySearchOption.pageCapacity(5);
// 分页编号
poiCitySearchOption.pageNum(3);
poiSearch.searchInCity(poiCitySearchOption);
// 设置poi检索监听者
poiSearch
.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
// poi 查询结果回调
@Override
public void onGetPoiResult(PoiResult poiResult) {
poiInfos = poiResult.getAllPoi();
if (poiInfos != null) {
PoiSearchAdapter poiSearchAdapter = new PoiSearchAdapter(
MoreAddressActivity.this, poiInfos,
locationLatLng);
// searchPois.setVisibility(View.VISIBLE);
searchPois.setAdapter(poiSearchAdapter);
}
}
// poi 详情查询结果回调
@Override
public void onGetPoiDetailResult(
PoiDetailResult poiDetailResult) {
}
});
}
}
///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
class PoiSearchAdapter extends BaseAdapter {
private Context context;
private List<PoiInfo> list;
private ViewHolder holder;
public PoiSearchAdapter(Context context, List<PoiInfo> appGroup, LatLng locationLatLng) {
this.context = context;
this.list = appGroup;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int location) {
return list.get(location);
}
@Override
public long getItemId(int arg0) {
return arg0;
}
public void addObject(List<PoiInfo> mAppGroup) {
this.list = mAppGroup;
notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(context).inflate(R.layout.activity_poi_search_item, null);
holder.mpoi_name = (TextView) convertView.findViewById(R.id.mpoiNameT);
holder.mpoi_address = (TextView) convertView.findViewById(R.id.mpoiAddressT);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.mpoi_name.setText(list.get(position).name);
holder.mpoi_address.setText(list.get(position).address);
// Log.i("yxx", "==1=poi===城市:" + poiInfo.city + "名字:" +
// poiInfo.name + "地址:" + poiInfo.address);
return convertView;
}
public class ViewHolder {
public TextView mpoi_name;// 名称
public TextView mpoi_address;// 地址
}
}
@Override
public void onMapStatusChange(MapStatus mapStatus) {
}
@Override
public void onMapStatusChangeFinish(MapStatus mapStatus) {
// 地图操作的中心点
LatLng cenpt = mapStatus.target;
geoCoder.reverseGeoCode(new ReverseGeoCodeOption().location(cenpt));
}
@Override
public void onMapStatusChangeStart(MapStatus mapStatus) {
}
@Override
public void onReceiveLocation(BDLocation bdLocation) {
// 如果bdLocation为空或mapView销毁后不再处理新数据接收的位置
if (bdLocation == null || mBaiduMap == null) {
return;
}
// 定位数据
MyLocationData data = new MyLocationData.Builder()
// 定位精度bdLocation.getRadius()
.accuracy(bdLocation.getRadius())
// 此处设置开发者获取到的方向信息,顺时针0-360
.direction(bdLocation.getDirection())
// 经度
.latitude(bdLocation.getLatitude())
// 纬度
.longitude(bdLocation.getLongitude())
// 构建
.build();
// 设置定位数据
mBaiduMap.setMyLocationData(data);
// 是否是第一次定位
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLngZoom(ll, 18);
mBaiduMap.animateMapStatus(msu);
}
locationLatLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
// 获取城市,待会用于POISearch
city = bdLocation.getCity();
// 创建GeoCoder实例对象
geoCoder = GeoCoder.newInstance();
// 发起反地理编码请求(经纬度->地址信息)
ReverseGeoCodeOption reverseGeoCodeOption = new ReverseGeoCodeOption();
// 设置反地理编码位置坐标
reverseGeoCodeOption.location(new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()));
geoCoder.reverseGeoCode(reverseGeoCodeOption);
// 设置查询结果监听者
geoCoder.setOnGetGeoCodeResultListener(this);
}
@Override
public void onGetGeoCodeResult(GeoCodeResult arg0) {
}
// 拿到变化地点后的附近地址
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
/*onGetReverseGeoCodeResult获取到结果之后,
mLocClient.stop(); 这里获取到附近定位的地址之后关闭定位*/
stopTome = System.currentTimeMillis();
// if (stopTome - startTime > 5000) {
// mImg_load_animation.setVisibility(View.GONE);
// mTv_net.setVisibility(View.VISIBLE);
// } else {
// mRl_gps.setVisibility(View.GONE);
// mRl_gps.setClickable(false);
// mImg_load_animation.setVisibility(View.GONE);
//}
mRl_gps.setVisibility(View.GONE);
mLocClient.stop();
final List<PoiInfo> poiInfos = reverseGeoCodeResult.getPoiList();
Log.i(TAG, "这里的值:" + poiInfos);
if (poiInfos != null && !"".equals(poiInfos)) {
PoiAdapter poiAdapter = new PoiAdapter(MoreAddressActivity.this, poiInfos);
lv_near_address.setAdapter(poiAdapter);
lv_near_address.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
String name = poiInfos.get(position).name.toString();
Intent intent = new Intent();
intent.putExtra("selectAddress", name);
setResult(RESULT_OK, intent);
Toast.makeText(MoreAddressActivity.this, name, Toast.LENGTH_LONG).show();
// finish();
}
});
}
}
class PoiAdapter extends BaseAdapter {
private Context context;
private List<PoiInfo> pois;
private LinearLayout linearLayout;
PoiAdapter(Context context, List<PoiInfo> pois) {
this.context = context;
this.pois = pois;
}
@Override
public int getCount() {
return pois.size();
}
@Override
public Object getItem(int position) {
return pois.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.locationpois_item, null);
linearLayout = (LinearLayout) convertView.findViewById(R.id.locationpois_linearlayout);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if (position == 0) {
holder.iv_gps.setImageDrawable(getResources().getDrawable(R.drawable.gps_grey));
holder.locationpoi_name.setTextColor(Color.parseColor("#000000"));
holder.locationpoi_address.setTextColor(Color.parseColor("#000000"));
}
if (position == 0 && linearLayout.getChildCount() < 2) {
ImageView imageView = new ImageView(context);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(32, 32);
imageView.setLayoutParams(params);
imageView.setBackgroundColor(Color.TRANSPARENT);
imageView.setImageResource(R.drawable.gps_grey);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
linearLayout.addView(imageView, 0, params);
holder.locationpoi_name.setTextColor(Color.parseColor("#000000"));
}
PoiInfo poiInfo = pois.get(position);
holder.locationpoi_name.setText(poiInfo.name);
holder.locationpoi_address.setText(poiInfo.address);
return convertView;
}
class ViewHolder {
ImageView iv_gps;
TextView locationpoi_name;
TextView locationpoi_address;
ViewHolder(View view) {
locationpoi_name = (TextView) view.findViewById(R.id.locationpois_name);
locationpoi_address = (TextView) view.findViewById(R.id.locationpois_address);
iv_gps = (ImageView) view.findViewById(R.id.iv_gps);
}
}
}
}
xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:fitsSystemWindows="true"
android:orientation="vertical">
<EditText
android:id="@+id/main_search_address"
android:layout_width="match_parent"
android:layout_height="40dp" />
<ListView
android:id="@+id/main_search_pois"
android:layout_width="match_parent"
android:layout_height="wrap_content">ListView>
<RelativeLayout
android:id="@+id/rl_search"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="@color/tab"
android:visibility="gone">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="12dp"
android:layout_marginTop="6dp"
android:layout_toRightOf="@+id/iv_left"
android:background="@color/bg_mine">
<ImageView
android:id="@+id/iv_search"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:paddingRight="6dp" />
<AutoCompleteTextView
android:id="@+id/et_search"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_toRightOf="@+id/iv_search"
android:background="@color/bg_mine"
android:gravity="center_vertical"
android:hint="请输入您的收货地址"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="14sp" />
RelativeLayout>
<ImageView
android:id="@+id/iv_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:padding="14dp"
android:src="@drawable/arrow_left" />
RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="280dp"
android:orientation="vertical"
android:visibility="visible">
<com.baidu.mapapi.map.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:onClick="true">com.baidu.mapapi.map.MapView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@color/transparent"
android:src="@drawable/gps_red" />
RelativeLayout>
<ListView
android:id="@+id/lv_near_address"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:cacheColorHint="#00000000"
android:descendantFocusability="beforeDescendants"
android:fastScrollEnabled="true"
android:scrollbars="none" />
LinearLayout>
<RelativeLayout
android:id="@+id/rl_gps"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<ImageView
android:id="@+id/img_load_animation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:src="@drawable/ic_launcher"
/>
<TextView
android:id="@+id/tv_net"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_centerInParent="true"
android:gravity="center"
android:text="请联网或打开GPS"
android:textSize="20sp"
android:visibility="gone"
/>
RelativeLayout>
RelativeLayout>
//getView的item布局
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="vertical"
android:paddingBottom="5.0dp"
android:paddingTop="5.0dp" >
<TextView
android:id="@+id/mpoiNameT"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10.0dp"
android:text="TextView"
android:textColor="@android:color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/mpoiAddressT"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10.0dp"
android:text="TextView"
android:textColor="@android:color/darker_gray"
android:textSize="14sp" />
LinearLayout>
LinearLayout>
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="@+id/locationpois_linearlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/iv_gps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:src="@drawable/gps_grey" />
<TextView
android:id="@+id/locationpois_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:text="威盛大厦"
android:textColor="#4A4A4A"
android:textSize="14sp" />
LinearLayout>
<TextView
android:id="@+id/locationpois_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginTop="4dp"
android:text="威盛大厦"
android:textColor="@color/darkgray"
android:textSize="12sp" />
LinearLayout>
下载地址:http://download.csdn.net/detail/xutaojxx/9891615
需要重新申请key