Assigned
Status Update
Comments
js...@google.com <js...@google.com> #2
We could add an API to make the weighted distance customizable, aosp/3271691 has more info.
da...@gmail.com <da...@gmail.com> #3
Thanks for your reply.
I didn't think to test on an other device and you're right, it works as expected on a pixel 5 device, both on my existing app and your example in a clean project from scratch.
However, I have the problem on a Pixel 2 simulator, even with your code in a clean project from scratch.
I also could reproduced it on a Pixel 1 simulator (see screenshot) but not on a Pixel 3.
Pixel 1 and 2 are 420dpi while pixel 3 and 5 are 440dpi, maybe related...
Hope you'll be able to reproduce it on your side.
Thanks
I didn't think to test on an other device and you're right, it works as expected on a pixel 5 device, both on my existing app and your example in a clean project from scratch.
However, I have the problem on a Pixel 2 simulator, even with your code in a clean project from scratch.
I also could reproduced it on a Pixel 1 simulator (see screenshot) but not on a Pixel 3.
Pixel 1 and 2 are 420dpi while pixel 3 and 5 are 440dpi, maybe related...
Hope you'll be able to reproduce it on your side.
Thanks
Description
Jetpack Compose component used: BorderStroke
Android Studio Build:
Android Studio Chipmunk | 2021.2.1 Patch 2
Build #AI-212.5712.43.2112.8815526, built on July 10, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.5
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.phrase.intellij (5.1.0), org.jetbrains.kotlin (212-1.7.10-release-333-AS5457.46)
Kotlin version: 1.7.0
Steps to Reproduce or Code Sample to Reproduce:
I tried to include jetpack compose in an existing app, and I realized that things look bigger in JetpackCompose component, event if I use the same DP values.
An example with border :
```
Row() {
Row(modifier = Modifier.border(border = BorderStroke(4.dp, Color.Black)),) {
Text(text = "test", style = TextStyle( fontSize = 12.sp))
}
Spacer(modifier = Modifier.size(8.dp))
AndroidView(factory = { ctx ->
val layout = LinearLayout(ctx)
layout.background = GradientDrawable().apply {
setStroke((TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4f, resources.displayMetrics)).toInt(), android.graphics.Color.parseColor("#000000"))
}
val textView = TextView(ctx).apply {
text = "test"
setTextSize(TypedValue.COMPLEX_UNIT_SP,12f)
}
layout.addView(textView)
layout
})
}
```
My example is easy, I define two containers in a jetpackCompose Row, one in Compose, and one with Android View.
My border is 4dp, and we can see a difference. It's a detail, but the difference is really visible when you mix compose/old components in an existing app.
You can see the difference on the joined picture (The red lines are just here to show the difference of height)
Left => jetpack compose
Right => AndroidView