Fixed
Status Update
Comments
re...@lunabee.com <re...@lunabee.com> #2
This should be moved to the Android Public Tracker > Text
component, but I don't have permissions so I'm redirecting to the appropriate owner.
cl...@gmail.com <cl...@gmail.com> #3
So after updating to 1.4.1 and all deps too, the crash was a little different see below.
The repro for that one is easy
- create a new app from AS 7.1 RC 1
- update deps to (Appcompat 1.4.1/Material 1.5.0/Constraintlayout 2.1.3)
- Add 2 textViews
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text1" />```
- In onCreate:
val t1 = findViewById<TextView>(R.id.text1)
val t2 = findViewById<TextView>(R.id.text2)
val charBuffer1 = CharArrayBuffer("AAA".toCharArray())
charBuffer1.sizeCopied = 3
val charBuffer2 = CharArrayBuffer("AAA".toCharArray())
charBuffer2.sizeCopied = 3
t1.setText(charBuffer1.data, 0, charBuffer1.sizeCopied)
t2.setText(charBuffer2.data, 0, charBuffer2.sizeCopied)
- Run see the texts updated then crash with the following. (Tested on P6 Pro Android 12)
Process: org.debug.myapplication, PID: 32493
java.lang.NullPointerException: src == null
at java.lang.System.arraycopy(Native Method)
at android.widget.TextView$CharWrapper.getChars(TextView.java:13588)
at android.text.TextUtils.getChars(TextUtils.java:155)
at android.text.BoringLayout.hasAnyInterestingChars(BoringLayout.java:314)
at android.text.BoringLayout.isBoring(BoringLayout.java:340)
at android.widget.TextView.onMeasure(TextView.java:9413)
at androidx.appcompat.widget.AppCompatTextView.onMeasure(AppCompatTextView.java:607)
at android.view.View.measure(View.java:25774)
at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:811)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.measure(BasicMeasure.java:466)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.measureChildren(BasicMeasure.java:134)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.solverMeasure(BasicMeasure.java:278)
at androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:120)
at androidx.constraintlayout.widget.ConstraintLayout.resolveSystem(ConstraintLayout.java:1594)
at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1708)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:496)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:761)
at android.view.View.measure(View.java:25774)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3628)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2424)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2694)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2143)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8665)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
an...@gmail.com <an...@gmail.com> #4
since it is possibly related to emojicompat reassigned
sa...@persgroep.net <sa...@persgroep.net> #5
Thanks for the report.
What version of Android are you testing this on?
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #6
Android 12 P6 pro P3a and emulator A 11.
Can test on others the last repro is easy to test.
se...@google.com <se...@google.com>
na...@google.com <na...@google.com> #7
Thanks! That's helpful to know it's reproing on both 11 and 12 - no need to test on others. We'll have to explore a bit.
Description
Jetpack Compose version: 1.2.0-alpha06 Jetpack Compose component used: ScrollableTabRow Android Studio Build: Android Studio Bumblebee | 2021.1.1 Patch 2 Build #AI-211.7628.21.2111.8193401 Kotlin version: 1.6.10
Our design system requires custom tab padding between tabs and for the tab minimum width to be customized. Within the
ScrollableTabRow
, every tab has a constraint around a hard-coded minimum tab width, which disallows us from using the standardScrollableTabRow
composable.See the line:
I'm proposing that
minTabWidth
either be provided as an optional parameter on theScrollableTabRow
composable with an ability to not have a constraint set or that it hooks into the modifier.I'm also proposing that we have a separate, new
tabPadding
parameter so that we can customize the left and right padding of the view that is composed for the Tab. Currently, this is being created by theScrollableTabRow
for us and there is no way for us to customize it. It would be beneficial to allow developers to customize this.