material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.19k stars 3.05k forks source link

TabItem causing rendering problem #3381

Closed razlesh1 closed 1 year ago

razlesh1 commented 1 year ago

Description: I'm using a TabLayout in my xml and 2 TabItems but when using material versions 1.8.0 and 1.9.0 listed below I get a render problem, but when I comment out the TabItems everything renders fine. When using version 1.7.0 this render problem is fixed.

Expected behavior: xml preview should render showing the tab layout with its items.

Source code:

<com.google.android.material.tabs.TabLayout
            android:id="@+id/tabLayout"
            style="@style/Background"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/spacing_large"
            android:contentDescription="@string/gallery"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/galleryMenu"
            app:tabIndicatorColor="@color/blueNeon"
            app:tabIndicatorFullWidth="false"
            app:tabMode="fixed"
            app:tabBackground="?attr/colorSurface"
            app:tabSelectedTextColor="@color/blueNeon"
            app:tabTextColor="@color/gray">

            <com.google.android.material.tabs.TabItem
                android:id="@+id/photos"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/photos" />

            <com.google.android.material.tabs.TabItem
                android:id="@+id/albums"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/albums" />

        </com.google.android.material.tabs.TabLayout>

Android API version: Android API version 33.

Material Library version: 'com.google.android.material:material:1.9.0' and also 'com.google.android.material:material:1.8.0'.

Device: Not for a device, for xml preview.

imhappi commented 1 year ago

Please update your Android Studio; see https://github.com/material-components/material-components-android/issues/3259

eeVoskos commented 1 year ago

Not working in the latest stable version Android Studio Flamingo 2022.2.1 Patch 1.