android - 如果存储库的属性不起作用,如何解决?
问题描述
我在我的活动中使用带有 MaterialAnimatedSwitch 的地图片段。还没有 Java 代码。
在 XML 中,当我尝试从 MaterialAnimatedSwitch 添加属性时,首先它们不会在键入前几个字母时显示,然后当我简单地编写属性时,如https://github.com/glomadrian/material-animated-switch所示 应用程序崩溃。
我知道这与命名空间的冲突有关
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:map="http://schemas.android.com/apk/res-auto"
两者都涉及。
我尝试了不同的可能性,例如在根布局中定义一个,在根布局中定义一个,在地图片段中定义一个,等等。
但结果是一样的。该应用程序因日志而崩溃
java.lang.RuntimeException:
Unable to start activity ComponentInfo
{com.example.dell.vehicledrivers/com.example.dell.vehicledrivers.MapsActivity}:
android.view.InflateException:
Binary XML file line #19: Binary XML file line #19:
Error inflating class com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch
我知道我犯了一个非常基本的错误,但我找不到任何提示。怎么可能解决?
编辑
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
tools:context=".MapsActivity" />
<com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch
android:id="@+id/driverSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="45dp"
android:layout_marginStart="45dp"
app:base_release_color="@android:color/darker_gray"
app:base_press_color="@android:color/white"
app:ball_release_color="@android:color/darker_gray"
app:ball_press_color="@android:color/white"
app:icon_release="@drawable/ic_location_off_black_24dp"
app:icon_press="@drawable/ic_location_on_black_24dp"
/>
</RelativeLayout>
解决方案
推荐阅读
- python - 如何从 Python 中的嵌套字典中删除某些键?
- python-3.x - O365 smtp 作为中继实现
- c++ - 系统组件的 C++ 依赖倒置
- influxdb - InfluxDB - 保持下采样记录的时间戳
- python - 如何获取循环结果并将它们转换为 Python 中的数组/列表?
- django - Django嵌套内联表单集-嵌套表单不保存到数据库,没有抛出错误
- javascript - jQuery动态添加可放置区域
- javascript - 通过调用 REST 服务初始化全局变量 AngularJS 的问题
- javascript - 使用 array.reduce() 进行复杂的嵌套分组
- javascript - 如果我有一个键,则从 n 对象数组中获取一个对象