android 地图视图交通信息
我尝试在地图视图上显示交通信息,但当它与本机地图应用程序完美配合(对于同一位置)时,没有显示任何内容。
这是我的代码:
public class Main extends MapActivity
{
private MapView map = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
map = new MapView(this,"XXXX");
map.setEnabled(true);
map.setClickable(true);
map.setBuiltInZoomControls(true);
map.setTraffic(true);
ll.addView(map, new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
setContentView(ll);
}
I try to display traffic informations on a mapview but nothing is shown while it works perfectly with the native Maps application (for the same location).
Here's my code:
public class Main extends MapActivity
{
private MapView map = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
map = new MapView(this,"XXXX");
map.setEnabled(true);
map.setClickable(true);
map.setBuiltInZoomControls(true);
map.setTraffic(true);
ll.addView(map, new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
setContentView(ll);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所在的地区一定没有太多交通信息。尝试在美国浏览,看看是否能看到那里的交通信息?
You must be in a region that doesn't have many traffic information. Try browsing in the US and see if you see some traffic info there ?