- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当它不是启动器 Activity 时, map Activity 不工作我还必须从应用程序标签中删除 name=MyApplication 以使其工作。如果我从其他类(class)打开 Activity ,但不会加载 map 。
list
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.byteshaft.medicosperuanos">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:fullBackupContent="true">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".introscreen.IntroScreen">
</activity>
<activity
android:name=".accountfragments.AccountManagerActivity"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".doctors.DoctorDetailsActivity"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".patients.DoctorsAppointment"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".patients.DoctorsLocator"/>
<activity
android:name=".patients.DoctorsRoute"/>
<activity
android:name=".patients.PatientsRecentHistory"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".patients.PatientDetails"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".patients.DoctorBookingActivity"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".patients.CreateAppointmentActivity"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".messages.ConversationActivity"
android:windowSoftInputMode="adjustResize" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
</application>
MapsActivity
package com.byteshaft.medicosperuanos;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
布局文件(activity_maps)
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.byteshaft.medicosperuanos.patients.DoctorsRoute" />
AppGlobals
package com.byteshaft.medicosperuanos.utils;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.support.v7.app.AlertDialog;
import android.view.MotionEvent;
import android.view.View;
import com.byteshaft.medicosperuanos.R;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
公共(public)类 AppGlobals 扩展应用程序 {
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
private static Context sContext;
public static final String IS_DOCTOR = "is_medicosperuanos";
public static Typeface typefaceBold;
public static Typeface typefaceNormal;
public static Typeface robotoBlack;
public static Typeface robotoBlackItalic;
public static Typeface robotoBold;
public static Typeface robotoBoldItalic;
public static Typeface robotoItalic;
public static Typeface robotoLight;
public static Typeface robotoLightItalic;
public static Typeface robotoMedium;
public static Typeface robotoMediumItalic;
public static Typeface robotoRegular;
public static Typeface robotoThin;
public static Typeface robotoThinItalic;
public static final String SERVER_IP = "https:.......";
public static final String BASE_URL = String.format("%s/api/", SERVER_IP);
public static final String REVIEW_URL = BASE_URL + "public/medicosperuanos/%s/review";
public static final String KEY_USER_NAME = "user_name";
public static final String KEY_FIRST_NAME = "first_name";
public static final String KEY_PROFILE_ID = "id";
public static final String KEY_LAST_NAME = "last_name";
public static final String KEY_DOC_SPECIALITY = "speciality";
public static final String KEY_DOC_ID = "identity_document";
public static final String KEY_COLLEGE_ID = "college_id";
public static final String KEY_DATE_OF_BIRTH = "dob";
public static final String KEY_GENDER = "gender";
public static final String KEY_ADDRESS = "address";
public static final String KEY_LOCATION = "location";
public static final String KEY_IMAGE_URL = "photo";
public static final String SERVER_PHOTO_URL = "server_photo_url";
public static final String KEY_LOGIN = "login";
public static final String KEY_PHONE_NUMBER_PRIMARY = "phone_number_primary";
public static final String KEY_PHONE_NUMBER_SECONDARY = "phone_number_secondary";
public static final String KEY_EMAIL = "email";
public static final String KEY_ACCOUNT_TYPE = "account_type";
public static final String KEY_USER_ID = "id";
public static final String KEY_AFFILIATE_CLINIC = "affiliate_clinic";
public static final String KEY_CHAT_STATUS = "available_to_chat";
public static final String KEY_INSURANCE_CARRIER = "insurance_carrier";
public static final String KEY_EMERGENCY_CONTACT = "emergency_contact";
public static final String KEY_SUBSCRIPTION_TYPE = "subscription_plan";
public static final String KEY_CONSULTATION_TIME = "consultation_time";
public static final String KEY_REVIEW_STARS = "review_stars";
public static final String KEY_SHOW_NEWS = "show_news";
public static final String KEY_SHOW_NOTIFICATION = "show_notification";
public static final String KEY_STATE = "state";
public static final String KEY_CITY = "city";
public static final String KEY_USER = "user";
public static final String KEY_GOT_INFO = "got_info";
public static final String KEY_FAVOURITE_STATE = "favourite";
public static final String KEY_STATE_SELECTED = "selected_state";
public static final String KEY_CITY_SELECTED = "selected_city";
public static final String KEY_SUBSCRIPTION_SELECTED = "selected_subscription";
public static final String KEY_CLINIC_SELECTED = "selected_clinic";
public static final String KEY_SPECIALIST_SELECTED = "selected_specialist";
public static final String KEY_INSURANCE_SELECTED = "selected_insurance";
public static final String PENDING = "pending";
public static final String ACCEPTED = "accepted";
public static final String REJCTED = "rejected";
public static final String KEY_TOKEN = "token";
public static final String USER_ACTIVATION_KEY = "activation_key";
public static final int LOCATION_ENABLE = 3;
public static ImageLoader sImageLoader;
public static final int CALL_PERMISSION = 4;
public static boolean isDoctorFavourite = false;
@Override
public void onCreate() {
super.onCreate();
disableSSLCertificateChecking();
sImageLoader = ImageLoader.getInstance();
sImageLoader.init(ImageLoaderConfiguration.createDefault(getApplicationContext()));
sContext = getApplicationContext();
typefaceBold = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/bold.ttf");
typefaceNormal = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/normal.ttf");
robotoBlack = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Black.ttf");
robotoBlackItalic = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_BlackItalic.ttf");
robotoBold = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Bold.ttf");
robotoBoldItalic = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_BoldItalic.ttf");
robotoItalic = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Italic.ttf");
robotoLight = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Light.ttf");
robotoLightItalic = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_LightItalic.ttf");
robotoMedium = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Medium.ttf");
robotoMediumItalic = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_MediumItalic.ttf");
robotoRegular = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Regular.ttf");
robotoThin = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_Thin.ttf");
robotoThinItalic = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Roboto_ThinItalic.ttf");
}
private static void disableSSLCertificateChecking() {
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
}
}
};
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return s.equals("46.101.34.116");
}
});
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (KeyManagementException | NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
public static void loginState(boolean type) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(KEY_LOGIN, type).apply();
}
public static boolean isLogin() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(KEY_LOGIN, false);
}
public static void userType(boolean type) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(KEY_ACCOUNT_TYPE, type).apply();
}
public static boolean isDoctor() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(KEY_ACCOUNT_TYPE, false);
}
public static void saveChatStatus(boolean state) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(KEY_CHAT_STATUS, state).apply();
}
public static boolean isOnline() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(KEY_CHAT_STATUS, false);
}
public static void saveNotificationState(boolean state) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(KEY_SHOW_NOTIFICATION, state).apply();
}
public static boolean isShowNotification() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(KEY_SHOW_NOTIFICATION, false);
}
public static void saveNewsState(boolean state) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(KEY_SHOW_NEWS, state).apply();
}
public static boolean isShowNews() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(KEY_SHOW_NEWS, false);
}
public static void saveFavourite(String drId, boolean isFavourite) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(drId, isFavourite).apply();
}
public static boolean isFavourite(String id) {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(id, false);
}
public static SharedPreferences getPreferenceManager() {
return getContext().getSharedPreferences("shared_prefs", MODE_PRIVATE);
}
public static void clearSettings() {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().clear().apply();
}
public static void saveDataToSharedPreferences(String key, String value) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putString(key, value).apply();
}
public static String getStringFromSharedPreferences(String key) {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getString(key, "");
}
public static void firstTimeLaunch(boolean value) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(IS_FIRST_TIME_LAUNCH, value).apply();
}
public static boolean isFirstTimeLaunch() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(IS_FIRST_TIME_LAUNCH, false);
}
public static Context getContext() {
return sContext;
}
public static void alertDialog(Activity activity, String title, String msg) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity, R.style.MyAlertDialogTheme);
alertDialogBuilder.setTitle(title);
alertDialogBuilder.setMessage(msg).setCancelable(false).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
public static void gotInfo(boolean type) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putBoolean(KEY_GOT_INFO, type).apply();
}
public static boolean isInfoAvailable() {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getBoolean(KEY_GOT_INFO, false);
}
public static void saveDoctorProfileIds(String key, int value) {
SharedPreferences sharedPreferences = getPreferenceManager();
sharedPreferences.edit().putInt(key, value).apply();
}
public static int getDoctorProfileIds(String key) {
SharedPreferences sharedPreferences = getPreferenceManager();
return sharedPreferences.getInt(key, -1);
}
public static void buttonEffect(View button) {
button.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
v.getBackground().setColorFilter(0xe0D1D1D1, PorterDuff.Mode.SRC_ATOP);
v.invalidate();
break;
}
case MotionEvent.ACTION_UP: {
v.getBackground().clearColorFilter();
v.invalidate();
break;
}
}
return false;
}
});
}
}
最佳答案
在布局文件中试试这个:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
希望对你有帮助;
关于android - map 仅在其 Activity 为 Launcher Activity 时加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43535431/
我正在尝试从一个 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 map 的 m
我是 Haskell 的新手,我认为函数 map map和 map.map在 Haskell 中是一样的。 我的终端给了我两种不同的类型, (map.map) :: (a -> b) -> [[a]
我的目标是创建一个 map 的 map ,这样我就可以通过它的键检索外部 map 的信息,然后通过它们的键访问它的“内部” map 。 但是,当我得到每个内部映射时,我最初创建的映射变成了一个对象,我
如何使用 Java8 编写以下代码? for (Entry> entry : data.entrySet()) { Map value = entry.getValue(); if (valu
我有覆盖整个南非的图片。它们为Tiff格式,并已将坐标嵌入其中。我正在尝试拍摄这些图像(大约20张图像),并将它们用作我的iPhone应用程序中的地图叠加层。我的问题在于(准确地)将地图切成图块。 我
所以我有 2 std::map s >一个是“旧的”,一个是“新的”,我想知道哪些文件被删除了,这样就能够遍历差异并对 shared_ptr 做一些事情。这样的事情可能吗?如何做到? 最佳答案 虽然
是否可以将当前查看的 google.maps.Map 转换为静态图像链接,以便我可以获取图像并将其嵌入到 PDF 中? 我在 map 上添加了一些带有自定义图标的标记,所以我不确定这是否真的可行。 如
你能帮我吗 Java Streams ? 从标题可以看出我需要合并List>>进入Map> . 列表表示为List>>看起来像: [ { "USER_1":{
对于 idAndTags 的第二个条目,内部映射被打乱,但第一个条目则不然 第一次接近! for (Map.Entry> entryOne : idAndTags.entrySet()) {
我将从我的代码开始,因为它应该更容易理解我想要做什么: @function get-color($color, $lightness) { @return map-get(map-get($col
我过去曾在许多网站上使用过 Google map ,但遇到了以前从未遇到过的问题。 map 窗口正在显示,但它只显示左上角的 map 片段,以及之后的任何内容(即使我在周围导航时),右侧也不会加载任何
众所周知,这些 map ,无论是常规街道 map 还是卫星 map ,在中国的特定地区都无法正确排列。那么哪个 map 排列正确,是卫星 map 还是默认街道 map ?一些网站表明卫星 map 是正
在拖尾事件之后,我面临着获取此处 map 中的 map 边界的问题。我需要新的经纬度来在新更改的视口(viewport)中获取一些项目/点。我只是想在拖动结束时获得谷歌地图map.getBounds(
我想做的是通过 ajax API 显示以英国邮政编码为中心的小型 bing 生成 map 。我相信这是可能的;我在 Bing map 文档中找不到如何将英国邮政编码转换为可以插入 map Ajax 控
我有一个 List我想转换成的 e Map>其中外部字符串应为“Name”,内部字符串应为“Domain”。 Name Id Domain e(0) - Emp1, 1, Insuran
我的第 2 部分:https://stackoverflow.com/questions/21780627/c-map-of-maps-typedef-doubts-queries 然后我继续创建 I
是否可以在 1 行中使用 Java8 编写以下所有 null 和空字符串检查? Map> data = new HashMap<>(holdings.rowMap()); Set>> entrySet
我正在审查一个项目的旧代码,并使用 Map 的 Map 的 Map 获得了如下数据结构(3 层 map ): // data structure Map>>> tagTree
这可能是一种不好的做法,但我还没有找到更好的解决方案来解决我的问题。所以我有这张 map // Map>> private Map>> properties; 我想初始化它,这样我就不会得到 Null
我们在 JDK 1.7 中使用 HashMap,我在使用 SonarQube 进行代码审查时遇到了一些问题。 请考虑以下示例: public class SerializationTest imple
我是一名优秀的程序员,十分优秀!