Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the code that I use to overlay buttons on top of the MapView.</p> <p>Android Layout</p> <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/home_container" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="YOURAPIKEY" android:clickable="true" /&gt; &lt;com.kyght.yourproject.TransparentPanel android:gravity="center_horizontal" android:id="@+id/transparent_panel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp"&gt; &lt;Button android:id="@+id/mapbtncenterme" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:padding="5dp" android:drawableTop="@drawable/ic_menu_mylocation" android:text="Find ME"/&gt; </code></pre> <p>Java Class</p> <pre><code>import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Paint.Style; import android.content.Context; import android.util.AttributeSet; import android.widget.LinearLayout; public class TransparentPanel extends LinearLayout { private Paint innerPaint, borderPaint ; public TransparentPanel(Context context, AttributeSet attrs) { super(context, attrs); init(); } public TransparentPanel(Context context) { super(context); init(); } private void init() { innerPaint = new Paint(); innerPaint.setARGB(225, 75, 75, 75); //gray innerPaint.setAntiAlias(true); borderPaint = new Paint(); borderPaint.setARGB(255, 255, 255, 255); borderPaint.setAntiAlias(true); borderPaint.setStyle(Style.STROKE); borderPaint.setStrokeWidth(2); } public void setInnerPaint(Paint innerPaint) { this.innerPaint = innerPaint; } public void setBorderPaint(Paint borderPaint) { this.borderPaint = borderPaint; } @Override protected void dispatchDraw(Canvas canvas) { RectF drawRect = new RectF(); drawRect.set(0,0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(drawRect, 5, 5, innerPaint); canvas.drawRoundRect(drawRect, 5, 5, borderPaint); super.dispatchDraw(canvas); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload