屏幕截图带有小地图的一部分

时间:2018-12-06 08:41:30

标签: android screen

<RelativeLayout
                android:id="@+id/lais1"
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:background="@color/purple"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:orientation="horizontal">
                <TextView
                    android:id="@+id/image1s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:padding="@dimen/tendp"
                    android:text="@string/add_picture"
                    android:textColor="@android:color/white"
                    android:textSize="@dimen/textSize"></TextView>

                <ImageView
                    android:id="@+id/image1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:layout_centerInParent="true"
                    ></ImageView>
                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_alignParentBottom="true"
                    android:background="@android:color/darker_gray"
                    android:layout_height="100dp">
                    <RelativeLayout
                        android:id="@+id/asdasdas"
                        android:layout_width="150dp"
                        android:layout_height="100dp">
                        <fragment
                            android:id="@+id/map"
                            class="com.google.android.gms.maps.SupportMapFragment"
                            android:layout_width="150dp"
                            android:layout_height="100dp"/>

                    </RelativeLayout>

                    <ImageView
                        android:id="@+id/sadad2"
                        android:visibility="gone"
                        android:layout_width="150dp"
                        android:layout_height="100dp" />
                    <TextView
                        android:layout_width="match_parent"
                        android:textColor="@android:color/white"
                        android:id="@+id/texto"
                        android:padding="20dp"
                        android:layout_height="wrap_content" />

                </LinearLayout>
            </RelativeLayout>

这是我要截屏的布局,这是解决方案。

View lais1 = (RelativeLayout)findViewById(R.id.lais1);
                       // lais1.setDrawingCacheEnabled(true);

                        bmf = Bitmap.createBitmap(lais1.getWidth(), lais1.getHeight(), Bitmap.Config.ARGB_8888);
                        Canvas canvas = new Canvas(bmf);
                        lais1.draw(canvas);

问题是,地图的一部分给了我黑屏,上面写着Google单词。所有其他部分都按我想要的方式显示,只是地图变成黑色,并在其上带有google字样。我该如何解决这个问题?因为我想通过whatsapp或其他程序将布局与地图共享为图像。

0 个答案:

没有答案