Reputation: 21
I am working on an Android App for skier and snowboarder which should navigate the user from one point to another.
To show the map I am using Mapsforge-Version 0.4.0.
On the map I have added some layers and now I want to add an Imagebutton but all attempts failed. Do you have some ideas how to do that without an Xml-File?
I am new and it is my first question, so if I have forget some information please let me know.
Upvotes: 2
Views: 809
Reputation: 134
STEP 1 : avoid setting content view to mapView
// setContentView(mapView);
STEP 2 :
add your button to a linearlayout
simply add your linearlayout to a relativelayout
<RelativeLayout
android:id="@+id/rlMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/llControls"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button" />
</LinearLayout>
</RelativeLayout>
STEP 3 : Find your RelativeLayout and add your mapView Object to it
RelativeLayout rlMap = (RelativeLayout) findViewById(R.id.rlMap);
rlMap.addView(mapView,0);
Upvotes: 3