我已搜查這個問題了幾個小時...... 是否有可能我的應用程序中啓動谷歌地圖導航並顯示與它的一些信息,一個TextView?我必須創建一個應用程序,將目標地址傳遞給地圖導航,而導航工作時,將在應用程序底部顯示帶有汽車模型名稱的文本視圖。這是可行的嗎?Android應用程序與谷歌地圖導航和文本覆蓋
2
A
回答
1
是否可以在我的應用程序中啓動Google地圖導航,並顯示帶有一些信息的文本視圖?
你不能嵌入在你的其他應用程序,你可以不是你自己的小部件添加到一些其他的應用程序的UI。
0
試試這個。
public class FloatingOverNewBooking extends Service {
private WindowManager windowManager;
private FrameLayout frameLayout;
private String str_ride_id;
public static final String BROADCAST_ACTION = "com.yourpackage.YourActivity";
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
timerLocation = new Timer();
createFloatingBackButton();
}
Timer timerLocation;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// to receive any data from activity
str_ride_id = intent.getStringExtra("RIDE_ID");
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
if (frameLayout != null) {
//((WindowManager) getSystemService(WINDOW_SERVICE)).removeView(frameLayout);
windowManager.removeView(frameLayout);
frameLayout = null;
}
timerLocation.cancel();
}
private void createFloatingBackButton() {
ClientLocatedActivity.isFloatingIconServiceAlive = true;
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
WindowManager.LayoutParams windowManagerParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY ,
WindowManager.LayoutParams. FLAG_DIM_BEHIND, PixelFormat.TRANSLUCENT);
params.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
frameLayout = new FrameLayout(this);
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
// Here is the place where you can inject whatever layout you want in the frame layout
layoutInflater.inflate(R.layout.share_new_booking_alert, frameLayout);
final TextView txtName = (TextView) frameLayout.findViewById(R.id.txtName);
Button backOnMap = (Button) frameLayout.findViewById(R.id.dialog_button);
if(!ObjectUtility.isNullOrEmpty(Config.Share.newPassenger)){
txtName.setText(Config.Share.newPassenger.getUsername());
}
backOnMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
am.killBackgroundProcesses("com.google.android.apps.maps");
//MainActivity.getInstance().getShareRideDataById("go");
FloatingOverNewBooking.this.stopSelf();
ClientLocatedActivity.isFloatingIconServiceAlive = false;
} catch (Exception e) {
e.printStackTrace();
}
}
});
windowManager.addView(frameLayout, windowManagerParams);
}
}
相關問題
- 1. 谷歌地圖導航 - 在Android應用程序中使用谷歌導航
- 2. 谷歌地圖與覆蓋
- 3. Android應用程序中的谷歌地圖v2操縱覆蓋
- 4. 谷歌地圖與Android應用程序
- 5. android谷歌地圖導航
- 6. 從Android應用程序訪問谷歌地圖導航
- 7. Android:谷歌地圖停用覆蓋
- 8. 谷歌地圖和導航
- 9. 導航Android和谷歌地圖
- 10. 停止谷歌地圖導航程序
- 11. 谷歌地圖視圖教程 - 覆蓋
- 12. 適用於Android應用的谷歌地圖覆蓋圖
- 13. 谷歌地圖覆蓋
- 14. 谷歌地圖覆蓋
- 15. 谷歌地圖覆蓋層
- 16. 谷歌地圖與覆蓋到pdf
- 17. Android谷歌地圖導航無意圖
- 18. 谷歌地圖在Android應用程序
- 19. Android谷歌地圖API導航設施
- 20. 谷歌地圖Android中的導航
- 21. Phonegap android和iPhone - 谷歌地圖api v3與導航語音api
- 22. 谷歌地圖導航
- 23. 導航谷歌地圖
- 24. 谷歌地圖導航點
- 25. 谷歌地圖導航
- 26. Xcode谷歌地圖導航
- 27. 谷歌地圖和谷歌地球應用程序
- 28. canvas.toDataURL爲谷歌地圖地面覆蓋
- 29. 谷歌地圖v3地面覆蓋?
- 30. 如何在Android應用中使用谷歌地圖導航?
先生我想在Android應用中使用谷歌地圖導航,但無法找到任何API,除了意圖谷歌地圖應用程序。你有任何替代的「意圖谷歌地圖應用程序」使用谷歌地圖導航功能。 –