material-components-android
material-components-android copied to clipboard
[Button] Vertical bar appers and gone on the right of button and textview's
This is a very strange behavior. I'm using bottom navigation and in one of the fragments (FA) there is a button. When the fragment is shown for the first time everything is normal. When we use bottom navigation to other fragments and then back to the FA, a vertical bar appears on the right of the button and then disappears in 3 seconds. This happens to buttons only with style using Widget.MaterialComponents.Button.OutlinedButton as parent style. Elevated is behaving as expected.
This is the style that the button uses
<style name="ButtonTopGroupRight" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="iconPadding">8dp</item>
<item name="fontFamily">@font/poppins</item>
<item name="iconTint">@drawable/button_top_group_right_selector</item>
<item name="strokeColor">@drawable/button_top_group_right_selector</item>
<item name="android:textColor">@drawable/button_top_group_right_selector</item>
</style>
Expected behavior:
Source code: The code snippet which is causing this issue
This is the button.
<com.google.android.material.button.MaterialButton
android:id="@+id/addFilterButtonWide"
style="@style/ButtonTopGroupRight"
android:layout_width="140dp"
android:layout_height="40dp"
android:text="@string/common_filter"
android:textColor="@color/black"
android:layout_gravity="start"
android:visibility="gone"
/>
Android API version:
minSdk = 29 compileSdk = 34
Material Library version:
material:1.11.0
Device:
Tested on Android 11,12 devices and Android 14 emulator.
Hi @kelalaka153,
Do you have a minimal sample app you can share with us that reproduces this? I don't see anything like this when trying to repro the issue on my end. Thanks!
I'm trying to minimize the code. need a little more time.
@kelalaka153 , I also saw this (a couple of months ago). I doubt it's been fixed in the latest 1.12.0 version of Material. I put android:scrollbars="none"
on the views that were showing the scrollbars 😕
@kelalaka153 , I also saw this (a couple of months ago). I doubt it's been fixed in the latest 1.12.0 version of Material. I put
android:scrollbars="none"
on the views that were showing the scrollbars 😕
That's interesting. Does it actually scroll if you, say, drag the label?
@langsmith Yes, it still exists in 1.12.0 and your suggestion removes the issue. Kudos.