Reputation: 31
I am currently unable to render am activity with just a TabLayout and ViewPager. I am getting this error:
Style ResourceReference{namespace=apk/res-auto, type=attr, name=textAppearanceButton} is not of type STYLE (instead attr)
From the following code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CompoundInterest">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginTop="86dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.tabs.TabItem
android:id="@+id/tabAbout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="About" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabCalculator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calculator" />
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tabLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>
I added the TabLayout and ViewPager to an otherwise blank, new layout and they have never rendered, even after being 'connected' to the fragments.
Upvotes: 3
Views: 2140
Reputation: 91
Go to the Android
View, find the Gradle Scripts
- build.gralde(Module :App)
then edit it.
change
implementation 'com.google.android.material:material:1.9.0'
to
implementation 'com.google.android.material:material:1.7.0'
Finally, click Sync Project with Gradle Files
, wait a minute, it would be fine.
Upvotes: 9
Reputation: 41
There seems to be a problem with version 1.8.0.
Other Material Design examples TabItems in TabLaout are also having rendering issues.
Downgrading to 1.7.0 works fine.
Upvotes: 4