use*_*811 9 android google-maps
我正在从缓存向Google地图添加多个TileOverlay.当尝试通过更改其可见性使用处理程序为它们设置动画时,在第一次播放期间地图上的叠加层会闪烁.
我可以通过其他任何方式实现这一目标吗?
public class LocalTileProvider implements TileProvider {
private String url;
DatabaseHelper db;
String type;
// private Paint opacityPaint = new Paint();
String newurl= PathFinder.rainradar_HDBaseurl;
String uid;
public LocalTileProvider(String uid,DatabaseHelper cache,String type){
this.uid=uid;
this.db=cache;
this.type=type;
}
//taking the tile from SQLITEDATABASE
@Override
public Tile getTile(int x, int y, int zoom){
Tile tile = null;
if(db.ispresent(uid, zoom,x , y,type)){
byte[] b=db.gettiles(uid, zoom,x , y,type);
tile = new Tile(256, 256, b);
return tile;
}
return NO_TILE;
}
}
Run Code Online (Sandbox Code Playgroud)
以下是将这些图块添加到Google地图的代码
LocalTileProvider provider1 = new LocalTileProvider(uidList.get(0), db, TAG);
TileOverlayOptions top1 = new TileOverlayOptions().tileProvider(provider1).visible(true);
tileoverlay_1 = googleMap.addTileOverlay(top1);
Run Code Online (Sandbox Code Playgroud)
添加它们之后,我通过切换磁贴的可见性来使用处理程序播放动画
public void start() {
btn_play.setEnabled(true);
tileoverlay_default.setVisible(false);
runnable_animation = new Runnable() {
@Override
public void run() {
//tileoverlay_default.setVisible(false);
isDownloading = false;
// stop_download=true;
isRunning = true;
btn_play.setBackgroundResource(R.drawable.player_pause_2x);
setVisibility(global);
if (global == 11) {
global = 0;
} else {
global = global + 1;
}
mHandler_animation.postDelayed(this, 1000);
}
};
mHandler_animation.post(runnable_animation);
}
Run Code Online (Sandbox Code Playgroud)
小智 -1
public class LocalTileProvider implements TileProvider
{
private String url;
DatabaseHelper db;
String type;
// private Paint opacityPaint = new Paint();
String newurl= PathFinder.rainradar_HDBaseurl;
String uid;
public LocalTileProvider(String uid,DatabaseHelper cache,String type)
{
this.uid=uid;
this.db=cache;
this.type=type;
}
//taking the tile from SQLITEDATABASE
@Override
public Tile getTile(int x, int y, int zoom)
{
Tile tile = null;
if(db.ispresent(uid, zoom,x , y,type))
{
byte[] b=db.gettiles(uid, zoom,x , y,type);
tile = new Tile(256, 256, b);
return tile;
}
return NO_TILE;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
572 次 |
| 最近记录: |