material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Button] Vertical bar appers and gone on the right of button and textview's

Open kelalaka153 opened this issue 11 months ago • 5 comments

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:

button_submit_1

button_submit_2

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.

kelalaka153 avatar Mar 27 '24 09:03 kelalaka153

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!

hunterstich avatar Mar 28 '24 18:03 hunterstich

I'm trying to minimize the code. need a little more time.

kelalaka153 avatar Apr 11 '24 13:04 kelalaka153

@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 😕

langsmith avatar May 14 '24 14:05 langsmith

@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?

pekingme avatar May 15 '24 05:05 pekingme

@langsmith Yes, it still exists in 1.12.0 and your suggestion removes the issue. Kudos.

kelalaka153 avatar May 15 '24 08:05 kelalaka153