https://kotlinlang.org
Join Slack
Is it possible in Jetpack compose to allow a child composable to be bigger than it’s parent, just no...
p

Per Jansson

over 2 years ago
Is it possible in Jetpack compose to allow a child composable to be bigger than it’s parent, just not show the overflowing part and still let the parent composable decide how much is shown? In this example, would it be possible for the inner blue box to actually render as 400dp but that the outer yellow box would not display the overflowing 200dp? Like in the web world with CSS you can use
overflow: hidden | clip
to achieve the same. In the example below both boxes will log that they are 200 in size, I would like the blue one to be 400 but only the top 200 would be visible.
Box(
  modifier = Modifier
    .size(200.dp)
    .background(Color.Yellow)
    .onGloballyPositioned { coordinates ->
       Log.d("BoxSize", "OUTER Width: ${coordinates.size.width}, Height: ${coordinates.size.height}")
    }
) {
    Box(
      modifier = Modifier
        .fillMaxWidth()
        .height(400.dp)
        .background(Color.Blue)
        .onGloballyPositioned { coordinates ->
           Log.d("BoxSize", "INNER Width: ${coordinates.size.width}, Height: ${coordinates.size.height}")
        }
    )
}
➕ 2
p
z
+2
  • 4
  • 7
  • 4966
What is the better way to mock date using mockk?
r

Recca Chao

about 4 years ago
What is the better way to mock date using mockk?
r
e
+2
  • 4
  • 18
  • 4803
I need to render Markdown in Compose (on Android). Does anyone have any recommendation for a library...
m

Marcin Wisniowski

over 2 years ago
I need to render Markdown in Compose (on Android). Does anyone have any recommendation for a library or solution? I'm currently considering this library: https://github.com/jeziellago/compose-markdown Or using this JetBrains library for parsing the Markdown: https://github.com/JetBrains/markdown and writing the Compose code myself to render the parsed text. Does anyone have any insight?
m
o
+4
  • 6
  • 14
  • 4499
How can I remove this padding from the Outlined Text Field that is reserved to the label if I dont w...
a

André Thiele

over 4 years ago
How can I remove this padding from the Outlined Text Field that is reserved to the label if I dont want to show a label? Or should I wrap it and clip its contents?
a
c
n
  • 3
  • 13
  • 4484
hello guys, is anyone having this Issue? ```java.lang.IllegalAccessError: class org.jetbrains.kotlin...
m

magnumrocha

about 4 years ago
hello guys, is anyone having this Issue?
java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext (in unnamed module @0x50148e28) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x50148e28
I am having this after update gradle to version 7.2…
youtrack 1
m
z
p
  • 3
  • 18
  • 4478
I want to achieve a “dynamic” height LazyVerticalGrid meaning the height of one item in the row dete...
i

iroyo

almost 3 years ago
I want to achieve a “dynamic” height LazyVerticalGrid meaning the height of one item in the row determines the height of the rest to avoid the effect of the image. The only “clean” way is to ditch the Grid and make a LazyColumn with a Row as each item?!! I know the other option would be to hard code the same height for every item in the grid, but that would produce (maybe) an unwanted space between rows. The code to produce the example is simple but it’s added in the thread
❤️ 1
i
r
  • 2
  • 10
  • 4182
Is anyone here familiar with the Open Telemetry Kotlin implementation: <https://github.com/open-tele...
j

james

over 3 years ago
Is anyone here familiar with the Open Telemetry Kotlin implementation: https://github.com/open-telemetry/opentelemetry-java/tree/main/extensions/kotlin. I'm trying to find the bit that allows the Span to propogate context across coroutines from a non-suspendable function:
runBlocking {
        val error = IllegalAccessException("Bad things are happening!")
        val message = "Isn't it a nice day"
        Span.current()?.let { span ->
            val attributes = Attributes.builder().apply {
                message?.let { put("error_message", it) }
            }
                .build()

            span.setStatus(StatusCode.ERROR)
            span.recordException(throwable, attributes)
        }
        
        launch { 
            // This will cause the spans to get linked together and then sync metadata from the above. 
            @WithSpan
            suspendFunction()
        }
    }
The reason i'm asking is that i'm trying to understand some strange behavior in our system where the context doesn't always propagate from a parent to child correctly.
j
e
+2
  • 4
  • 10
  • 4156
When is the `init { }` block in a ViewModel called? The init block for Screen A's ViewModel doesn't ...
v

v79

almost 3 years ago
When is the
init { }
block in a ViewModel called? The init block for Screen A's ViewModel doesn't seem to be triggered when swiping back from Screen B, for instance.
v
y
+3
  • 5
  • 26
  • 4145
Hi! How can I detect if Composable element is visible on the screen or vice versa, without too much ...
v

Valentin Gusselnikov

over 3 years ago
Hi! How can I detect if Composable element is visible on the screen or vice versa, without too much calculations? I want to hide the top
Image
if the
Button
(which is placed at the end) is not visible and user have to scroll for it. Root Composable is
ConstraintLayout
🙏 1
v
  • 1
  • 1
  • 4106
What's the correct way of rendering html string in compose? Something very similar to `HtmlCompat.fr...
r

ritesh

about 4 years ago
What's the correct way of rendering html string in compose? Something very similar to
HtmlCompat.fromHtml()
in textView.
👀 1
r
s
z
  • 3
  • 9
  • 4070
Previous123Next

kotlinlang

A modern programming language that makes developers happier.

Powered by