import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.compose.GoogleMap
import com.google.maps.android.compose.MarkerComposable
import com.google.maps.android.compose.MarkerState
class TestActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
GoogleMap(
modifier = Modifier.fillMaxSize()
) {
MarkerComposable(
keys = arrayOf("singapore4"),
state = MarkerState(
position = LatLng(
25.0, 25.0
)
),
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.clip(RoundedCornerShape(8.dp))
.background(Color.White),
) {
AsyncImage(
model = "https://picsum.photos/200/300",
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier
.padding(top = 4.dp, start = 6.dp, end = 6.dp)
.size(50.dp)
.clip(CircleShape)
.border(2.dp, Color.Black, CircleShape)
)
Text(
maxLines = 1,
textAlign = TextAlign.Center,
text = "Hello",
modifier = Modifier
.width(60.dp),
style = MaterialTheme.typography.labelSmall
)
}
}
}
}
}
}
implementation 'com.google.maps.android:maps-compose:2.14.0'android 12 emulatorPaste this into your project:
your get:
RealImageLoader com.example.yourpackage I 🏗 Cancelled - https://picsum.photos/200/300