提交 33f6e28c 编写于 作者: S suhy

添加地图

上级 2568ded6
......@@ -28,6 +28,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".BottleApplication"
android:allowBackup="true"
android:icon="@mipmap/app_icon"
android:label="@string/app_name"
......@@ -70,7 +71,7 @@
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="FfDzoP46lC7y9hNTLLbQWMgIY8nEtrod" />
android:value="ofrmNdIYHObGQLFd5KQc8xYjD8ZTmZHA" />
</application>
</manifest>
\ No newline at end of file
package com.example.myhomework;
import android.app.Application;
import com.baidu.mapapi.CoordType;
import com.baidu.mapapi.SDKInitializer;
public class BottleApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//在使用SDK各组件之前初始化context信息,传入ApplicationContext
SDKInitializer.initialize(this);
//自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
//包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
SDKInitializer.setCoordType(CoordType.BD09LL);
}
}
......@@ -7,8 +7,6 @@ import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.example.myhomework.R;
import com.example.myhomework.databinding.ActivityMainBinding;
import com.example.myhomework.databinding.FragmentMapBinding;
......@@ -17,6 +15,7 @@ public class MapFragment extends Fragment {
FragmentMapBinding binding;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
......@@ -24,6 +23,7 @@ public class MapFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
binding = FragmentMapBinding.inflate(getLayoutInflater());
return binding.getRoot();
}
}
\ No newline at end of file
......@@ -8,8 +8,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.myhomework.R;
import com.example.myhomework.databinding.FragmentMapBinding;
import com.example.myhomework.databinding.FragmentMineBinding;
......
......@@ -8,6 +8,21 @@
android:layout_height="match_parent">
<fragment
android:id="@+id/nav_host_fragment_activity_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="70dp"
android:elevation="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:navGraph="@navigation/mobile_navigation" />
<com.example.myhomework.view.RadiusCardView
......@@ -56,18 +71,5 @@
app:srcCompat="@drawable/add_btn" />
<fragment
android:id="@+id/nav_host_fragment_activity_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册