W aktywności mam CardView w której mam TabLayout i ViewPager.
Wszystko pięknie działa ale mam problem z ustawieniem wysokości karty
kod:
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="1dp">
<com.google.android.material.tabs.TabLayout
android:id="@+id/cv_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@color/colorGlowny"
app:tabSelectedTextColor="@color/colorGlowny"
app:tabTextColor="@color/colorTextLight" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/cv_view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="48dp">
</androidx.viewpager.widget.ViewPager>
</androidx.cardview.widget.CardView>
teraz mam na sztywno ustawioną wysokość na 220dp
android:layout_height="220dp"
ale chciałbym żeby wysokość karty dostosowywała się do zawartości.
Tak wygląda kod fragmentu które zmieniaja sie w ViewPager:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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="wrap_content"
tools:context=".fragmenty.PierwszyFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView11"
android:layout_marginTop="4dp"
android:layout_marginLeft="8dp"
android:text="text text text" />
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginRight="8dp"
android:text="text text text text text text"
android:textColor="@color/colorGlowny"
android:textSize="18sp"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView10"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="8dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="8dp"
android:text="Więcej"
android:textColor="@color/colorGlowny"
android:theme="@style/Theme.MaterialComponents"
app:rippleColor="@color/colorTextLight"
app:strokeColor="@color/colorGlowny"
app:strokeWidth="1dp" />
</RelativeLayout>
</FrameLayout>
Co i gdzie muszę zmienić żeby wysokość karty dostosowywała się do zawartości?