Change background color of map fragment

How to change it?
I followed these steps: https://developer.tomtom.com/maps-android-sdk/map-initialization
but it seems to not work
Linking fail: attribute mapBackgroundColor not found

1 Like

Hi Kamil!

Welcome to our community :slight_smile:

Can you please share which version of the SDK you are using, because I’ve checked this and it seems to work fine. In the title, you are saying about map fragment, but you are using a parameter for the MapView. Maybe this is the problem? Please find an XML fragment which works for me:
<fragment
android:id="@+id/map_fragment"
android:name=“com.tomtom.online.sdk.map.MapFragment”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:customMapBackgroundColor="#0000ff"/>

I hope this helps a little bit. Let us know if you’ll have more questions.

2 Likes

My xml layout file:

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
    android:id="@+id/mapFragment"
    android:name="com.tomtom.online.sdk.map.MapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:customMapBackgroundColor="#0000ff" />

sdk-maps version:
implementation ‘com.tomtom.online:sdk-maps:2.438’

android sdk version:
android compileSdkVersion 28

1 Like

Thanks a lot for giving me more details.

I can reproduce your issue now, and I see that you are using a very old SDK version.
It is highly recommended to use the newest SDK version.
Please change your old 2.438 version to the newest one (implementation 'com.tomtom.online:sdk-maps:2.4340') and your issue should be solved.

Let us know if this helps.

1 Like

Yes, it works, thanks a lot