第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Google 地圖不顯示在片段中

Google 地圖不顯示在片段中

函數(shù)式編程 2023-11-01 22:43:18
如果我發(fā)布的問題與許多其他問題類似,但每個問題都有不同的谷歌地圖實現(xiàn),并且嘗試所有方法都意味著完全破壞我的代碼,我很抱歉,因為我是 Android 開發(fā)新手,所以我寧愿如果你能幫我找出我的地圖出了什么問題,就不要冒險了。謝謝。當我運行我的應用程序時,我得到的是: 這是我的 Gradle.build(應用程序):apply plugin: 'com.android.application'android {    compileSdkVersion 28    buildToolsVersion "29.0.2"    defaultConfig {        applicationId "com.example.binfo"        minSdkVersion 27        targetSdkVersion 28        versionCode 1        versionName "1.0"        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'        }    }}dependencies {    implementation fileTree(dir: 'libs', include: ['*.jar'])    implementation 'androidx.appcompat:appcompat:1.0.2'    implementation 'androidx.legacy:legacy-support-v4:1.0.0'    implementation 'com.google.android.material:material:1.0.0'    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'    implementation 'androidx.navigation:navigation-fragment:2.0.0'    implementation 'androidx.navigation:navigation-ui:2.0.0'    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'    testImplementation 'junit:junit:4.12'    androidTestImplementation 'androidx.test:runner:1.1.1'    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'    implementation 'com.google.android.gms:play-services-maps:17.0.0'//    implementation 'com.google.android.gms:play-services:12.0.1'    implementation 'com.google.firebase:firebase-analytics:17.2.0'    implementation 'com.google.firebase:firebase-firestore:21.1.1'}apply plugin: 'com.google.gms.google-services'
查看完整描述

2 回答

?
牛魔王的故事

TA貢獻1830條經(jīng)驗 獲得超3個贊

根據(jù)您的代碼,我沒有發(fā)現(xiàn)任何錯誤,但根據(jù)您的屏幕截圖,您的互聯(lián)網(wǎng)連接似乎丟失了,所以您能否先提供正確的互聯(lián)網(wǎng)連接并檢查一下。



查看完整回答
反對 回復 2023-11-01
?
不負相思意

TA貢獻1777條經(jīng)驗 獲得超10個贊

在您的片段中使用 MapView:


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    tools:context=".HomeFragment">


    <com.google.android.gms.maps.MapView

        android:id="@+id/mapView"

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:layout_below="@+id/llSelectDetails" />


</RelativeLayout>

在您的片段中使用:


  public class HomeFragment extends Fragment implements OnMapReadyCallback {


    private GoogleMap mMap;

    private MapView mMapView;


    @Override

        public View onCreateView(LayoutInflater inflater, ViewGroup container,

                                 Bundle savedInstanceState) {

            // Inflate the layout for this fragment

            View rootView = inflater.inflate(R.layout.fragment_home, container, false)


             /*

             * Configure Mapview and sync to google map.

             */

            mMapView = rootView.findViewById(R.id.mapView);

            mMapView.onCreate(savedInstanceState);

            mMapView.getMapAsync(this);

            mMapView.onResume(); // needed to get the map to display immediately


             //your code

            return rootView;

    }


    @Override

        public void onMapReady(GoogleMap googleMap) {

            this.mMap = googleMap;

        }

    }

它會工作得很好。另外,請檢查您的地圖密鑰和互聯(lián)網(wǎng)連接。


查看完整回答
反對 回復 2023-11-01
  • 2 回答
  • 0 關(guān)注
  • 160 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號