作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用它在我的 map fragment 中进行向上滑动布局,但我的应用程序一次又一次地崩溃,我不明白发生了什么。在错误报告中,它只是说 Binary XML file line #34 Binary XML file line #34: “Error inflating class fragment”。
这是我的 MapsActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:app="http://schemas.android.com"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
app:umanoDragView="@+id/dragView"
app:umanoOverlay="true"
app:umanoPanelHeight="68dp"
app:umanoParalaxOffset="100dp"
app:umanoShadowHeight="4dp">
<android.support.v4.widget.DrawerLayout android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="#FFFFFF">
<ImageView
android:id="@+id/tree_button"
android:layout_width="40dp"
android:layout_height="40dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/tree" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Ecology"
android:textColor="@color/colorAccent"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity">
</fragment>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/menu">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
<include layout="@layout/bottom_data">
</include>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>
底部数据.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_hideable="false"
android:clickable="true"
app:behavior_peekHeight="56dp"
app:layout_behavior="@string/bottom_sheet_behavior"
android:orientation="vertical">
<TextView
android:id="@+id/tex1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="EXPLORE "
android:textSize="30sp"
android:textStyle="bold" />
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tex1"
android:layout_centerInParent="true"
android:layout_marginTop="30dp"
android:text="Your Place" />
<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/b1"
android:layout_centerInParent="true"
android:layout_marginTop="30dp"
android:text="My Place" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/b2"
android:layout_centerInParent="true"
android:layout_marginTop="30dp"
android:text="Many to find " />
</LinearLayout>
提前致谢!
最佳答案
试试这段代码..
Android studio 也提供 map Activity ..您可以轻松添加。
将以下依赖项添加到应用程序级别的 gradle 文件中。
implementation 'com.google.android.gms:play-services-maps:16.1.0'
之后你的错误就解决了。
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
关于android - 类似于谷歌地图的 map fragment 中的向上滑动面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55301351/
leaflet:一个开源并且对移动端友好的交互式地图 JavaScript 库 中文文档: https://leafletjs.cn/reference.html 官网(英文): ht
我是一名优秀的程序员,十分优秀!