mol*_*man 5 java android border android-mapview
我试图在单击按钮时在mapView周围绘制边距.
所以这就是我所尝试过的,它不起作用.mapview位于相对布局中.
LayoutInflater inflater = getLayoutInflater();
LinearLayout mView = (LinearLayout) inflater.inflate(
R.layout.map_view_create_ps, mapView, false);
GeoPoint viewLoc = mapView.getMapCenter();
MapView.LayoutParams params = new MapView.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,
viewLoc,
MapView.LayoutParams.BOTTOM_CENTER);
mView.setLayoutParams(params);
mapView.addView(mView);
mView.setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)
单击按钮时会调用上面的内容
我的create_ps_layout就是这样
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@android:color/transparent">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/linearLayout1" android:orientation="vertical"
android:layout_height="fill_parent"
android:background="@drawable/rounded_boarder"></LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
可绘制的背景是这样的
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="@color/translucent_black" />
<corners android:bottomRightRadius="30dp"
android:bottomLeftRadius="30dp" android:topLeftRadius="30dp"
android:topRightRadius="30dp" />
<stroke android:width="2dip" android:color="#FFB600"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
这不起作用,但是当你选择按钮时,你们可以指出我在如何在mapview周围绘制边框的正确方向吗?
din*_*rma 11
将mapview放在一个RelativeLayout中,并设置RelativeLayout的padding属性,如下所示:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_weight="1"
android:background="#444" android:padding="2dp">
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="YOUR-MAP-KEY"
android:clickable="true"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)