Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/158.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为定制的android谷歌地图信息窗口添加阴影_Android_Google Maps Markers - Fatal编程技术网

如何为定制的android谷歌地图信息窗口添加阴影

如何为定制的android谷歌地图信息窗口添加阴影,android,google-maps-markers,Android,Google Maps Markers,我的自定义信息窗口视图: <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:la

我的自定义信息窗口视图:

<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>
但cardview似乎不像往常那样有阴影。使用cardview的立面或平移Z没有帮助

为什么cardview的shadow在谷歌地图上不起作用


给我的自定义信息窗口添加阴影的最佳或最简单的方法是什么?

可以自定义地图标记而不是自定义信息吗window@TaQuangTu您的意思是将信息窗口放在custommarker.xml中,然后显示或隐藏信息窗口视图吗?能否在信息窗口的布局中设置阴影背景图像?或者你能在你的直线布局周围加上阴影吗?我希望这些能对你有所帮助。:)@是的!我试过了successfully@ModiHarsh它不起作用,背景图像不能与线性布局的子对象具有相同的大小。由于LinearLayout wrapcontent,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;

            }
        });