android - 如何为自定义的 android 谷歌地图信息窗口添加阴影
问题描述
我的自定义信息窗口视图:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="7dp"
app:cardElevation="2dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="test" />
</androidx.cardview.widget.CardView>
</LinearLayout>
然后我用它:
map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
View v = getLayoutInflater().inflate(R.layout.layout_marker_title, null);
TextView tv_title = v.findViewById(R.id.tv_title);
tv_title.setText(arg0.getTitle());
return v;
}
@Override
public View getInfoContents(Marker arg0) {
return null;
}
});
但是cardview似乎没有像往常一样有阴影。玩 cardview 的海拔或 translationZ 没有帮助。
为什么cardview的影子在谷歌地图上不起作用?
给我的自定义信息窗口添加阴影的最佳或最简单的方法是什么?
解决方案
推荐阅读
- asp.net - 我在哪里可以在 ASP.NET 中配置这个 AutoMapper
- ubuntu - go 1.13 有 go tools 版本 12.9
- php - 限制 MySQL 的“发送数据”时间
- python - 如何在 Keras 中为自动编码器打乱训练数据
- c++ - 使用 std::cout 和时如何避免数据竞争
在多线程程序中? - html - docx4j 无法渲染
- android - 退出首选项后刷新选项菜单
- aem - 是否有一种 OOTB 方法来检查工作流 - AEM6.5 中有效负载(页面)的资产?
- java - 如何使用秘密 base64 编码在 Java 中创建 JWT
- html - 无法强制下载外部链接