so im getting this W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1 spamming the logs, the answer I've read here suggests its a bug that was fixed but is still present, but wondered if anyone has a work around, the user that posted the question found it was an issue when using max lines and ellipsize but im not using either, if anyone can help I'd appreciate it, i have a view pager inside a view pager that displays a card with a bottom navigation view and some tabs (please don't question the design there is a method in this madness) here is my inner view pager layout
<?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:attrs="http://schemas.android.com/tools"
android:id="@+id/slide_background"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/title_guideline"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.16" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ThemeOverlay.MyTitleText"
android:text="@string/choose_a_theme"
android:textColor="@color/background_light"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/title_guideline"
android:gravity="center"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content"
android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@id/title_guideline"
app:layout_constraintBottom_toTopOf="@id/spacer"
android:layout_height="0dp">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/pageIndicatorView"/>
<com.rd.PageIndicatorView
android:id="@+id/pageIndicatorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/view_pager"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/sub_title_guideline"
android:layout_marginTop="16dp"
app:piv_animationType="slide"
app:piv_dynamicCount="true"
app:piv_interactiveAnimation="true"
app:piv_selectedColor="@android:color/white"
app:piv_unselectedColor="@color/accent_yellow"
app:piv_viewPager="@id/view_pager"
attrs:piv_padding="12dp"
attrs:piv_radius="8dp"/>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/sub_title_guideline"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.84" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ThemeOverlay.MyBodyText"
app:layout_constraintTop_toBottomOf="@id/sub_title_guideline"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:paddingTop="@dimen/activity_horizontal_margin_4dp"
android:paddingBottom="@dimen/activity_horizontal_margin_4dp"
android:paddingStart="@dimen/activity_horizontal_margin_32dp"
android:paddingEnd="@dimen/activity_horizontal_margin_32dp"
android:id="@+id/subTitle"
android:textColor="@color/background_light"
android:text="@string/please_choose_a_theme"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="match_parent"
android:layout_height="100dp"
android:id="@+id/spacer"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
and here is my view holder that contains a toolbar, tabs and bottom nav bar, the whole thing is essentially a dummy layout to give a user a preview of what a layout will look like given a particular theme, there is nothing in any of my styles except setting colours,
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintWidth_percent="0.8"
app:layout_constraintWidth_max="@dimen/max_create_profile_card"
app:cardElevation="@dimen/activity_horizontal_margin_8dp"
app:cardCornerRadius="8dp"
android:layout_margin="@dimen/activity_horizontal_margin_4dp"
app:cardBackgroundColor="@color/background_light">
<androidx.appcompat.widget.Toolbar
style="?attr/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="56dp"
android:id="@+id/preview_toolbar"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:id="@+id/sentence_container"
app:layout_constraintTop_toTopOf="parent"/>
<com.google.android.material.tabs.TabLayout
style="?attr/tabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="56dp"
android:id="@+id/preview_tabs"
app:layout_constraintTop_toBottomOf="@id/sentence_container">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</com.google.android.material.tabs.TabLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:id="@+id/space"
app:layout_constraintTop_toBottomOf="@id/preview_tabs"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background_light"
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
app:layout_constraintTop_toBottomOf="@id/space"
app:menu="@menu/navigation" />
<com.github.sealstudios.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/speak_fab"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/preview_tabs"
android:src="@drawable/ic_play_arrow_white_24dp"
app:fab_size="mini"
android:layout_margin="@dimen/fab_margin"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
i set these attributes to my tablayout
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
tabLayout.setTabMode(TabLayout.MODE_FIXED);
and i set tab icons and text like this
private void setUpMaterialTabs(String[] labels,int[] tabIcons){
for (int i = 0; i < labels.length; i++){
int index = i * 2;
Tab tab = tabLayout.getTabAt(i);
if (theme.equals(Constants.THEME_YELLOW)){
Objects.requireNonNull(tab).setIcon(tabIcons[index]);
}else{
Objects.requireNonNull(tab).setIcon(tabIcons[index + 1]);
}
tab.setText(labels[i]);
}
setTabTextColor(theme, getActivity());
}
ok using my own tab avoids the error