I tried this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
map:mapType="normal"
/>
</LinearLayout>
But I got 2 errors:
<fragment xmlns:map="http://schemas.android.com/apk/res-auto"
: Unexpected namespace prefix "xmlns" found for tag fragment
2.map:mapType="normal"
:
Unexpected namespace prefix "map" found for tag fragment
What am I doing wrong, and how should it looks like in order to integrate more objects except the Google Map in my app...
thnx !
EDIT !!
I tried this, and it works !
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
map:mapType="normal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
</LinearLayout>
Can't understand why.. also can't understand what map:mapType="normal"
and xmlns:map="http://schemas.android.com/apk/res-auto"
means... ??
To create a linear layout in which each child uses the same amount of space on the screen, set the android:layout_height of each view to "0dp" (for a vertical layout) or the android:layout_width of each view to "0dp" (for a horizontal layout). Then set the android:layout_weight of each view to "1" .
We can use LinearLayout inside RelativeLayout. We can also use RelativeLayout as a Child of LinearLayout.
public class SupportMapFragment extends Fragment. A Map component in an app. This fragment is the simplest way to place a map in an application. It's a wrapper around a view of a map to automatically handle the necessary life cycle needs.
Have you tried:
<LinearLayout
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>
</LinearLayout>
From http://developer.android.com/reference/com/google/android/gms/maps/SupportMapFragment.html it looks like the two attributes are not needed.
i also substituted class
for android:name
.
To use the map
attributes you need to add the namespace (i think you can add it to the LinearLayout
, more information at https://developers.google.com/maps/documentation/android/map#using_xml_attributes .
If the attributes aren't working i'd probably just set the values programmatically.
For what I know it a known bug that if you wrap your map with a layout, you can't use map
prefix properties on it and you have to customize the map in your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With