Assigned
Status Update
Comments
si...@gmail.com <si...@gmail.com> #2
I face with the same problem. I have different pageMargin in landscape and portrait and when viewpager is scrolled for the more than first position, after rotating device it is shifted.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
Description
Version used: androidx.appcompat:appcompat:1.6.1
Devices/Android versions reproduced on: Android 14
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).
UseCase: By default i like to append "*" to certain textview. So i have created a CustomTextView extending AppCompatTextView. And override the setText method to append the "*" at last of the textview.
override fun setText(text: CharSequence?, type: BufferType?)
{
val mText = "$text *"
val displayText = SpannableString(mText)
displayText.setSpan(ForegroundColorSpan(ContextCompat.getColor(context, R.color.red_label)), text?.length ?: 0, mText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
super.setText(displayText, type)
}
When run the "*" is appended twice to the text.
Screenshot: Attached below.
Github link: