java– 如何在mapview周围绘制边框

java– 如何在mapview周围绘制边框,第1张

概述我试图在单击按钮时在mapView周围绘制边距.所以这就是我所尝试过的,它不起作用.mapview位于相对布局中.LayoutInflaterinflater=getLayoutInflater();LinearLayoutmView=(LinearLayout)inflater.inflate(R.layout.map_view_create_ps,mapVi

我试图在单击按钮时在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);

单击按钮时会调用上面的内容

我的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>

可绘制的背景是这样的

<?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>

这不起作用,但是当你选择按钮时,你们可以指出我在如何在mapvIEw周围绘制边框的正确方向吗?

解决方法:

将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>
总结

以上是内存溢出为你收集整理的java – 如何在mapview周围绘制边框全部内容,希望文章能够帮你解决java – 如何在mapview周围绘制边框所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1119676.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存