How can I leave CardView with dynamic size?

0

I have a problem ...

I have several CardsView and the size of them is static I would like to know how I can make this size adaptable to what you have in cardView.

Because in a CardView I have a list that comes with data from the database and if the size is static it will end up not showing up all the records.

How can I make this CardView adaptable to the size of the listView?

Here's a snippet of my code:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#DCDCDC"
android:scrollbars="none"
android:fillViewport="true">

    <LinearLayout
        android:id="@+id/hide_layout"
        android:padding="10dp"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.CardView
            android:id="@+id/id_ocorrecia"
            card_view:cardCornerRadius="5dp"
            card_view:cardElevation="2dp"
            android:layout_width="match_parent"
            android:layout_height="380dp"
            android:layout_gravity="center">
            <LinearLayout
                android:layout_gravity="center"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                    <LinearLayout
                        android:orientation="vertical"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <LinearLayout
                                android:layout_width="0dp"
                                android:layout_weight="5"
                                android:layout_height="wrap_content">
                                <TextView
                                    android:paddingLeft="8dp"
                                    android:paddingTop="12dp"
                                    android:paddingBottom="12dp"
                                    android:layout_marginLeft="8dp"
                                    android:textSize="15dp"
                                    android:textStyle="bold"
                                    android:textColor="@color/preto"
                                    android:text="Ocorrências"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:id="@+id/txtEquipe"
                                    />
                            </LinearLayout>
                        </LinearLayout>

                            <LinearLayout
                                android:background="#A9A9A9"
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                >
                                <LinearLayout
                                    android:layout_marginTop="12dp"
                                    android:layout_marginLeft="5dp"
                                    android:padding="10dp"
                                    android:orientation="horizontal"
                                    android:layout_width="10dp"
                                    android:layout_height="10dp"
                                    android:background="#A9A9A9"
                                    ></LinearLayout>

                                    <LinearLayout
                                        android:layout_width="0dp"
                                        android:layout_weight="8"
                                        android:layout_height="wrap_content">
                                        <TextView
                                            android:textStyle="bold"
                                            android:textColor="@color/preto"
                                            android:textSize="12dp"
                                            android:padding="8dp"
                                            android:text="SERVIÇO"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:ems="10"
                                            android:id="@+id/ff"
                                            />

                                    </LinearLayout>
                                <LinearLayout
                                    android:layout_weight="4"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent">
                                    <TextView
                                        android:textColor="@color/preto"
                                        android:textSize="12dp"
                                        android:textStyle="bold"
                                        android:padding="8dp"
                                        android:gravity="center"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:ems="10"
                                        android:text="TOTAL"
                                        android:id="@+id/txtTotal"
                                        />
                                </LinearLayout>
                                <LinearLayout
                                    android:layout_weight="4"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent">
                                    <TextView
                                        android:layout_gravity="center"
                                        android:textColor="@color/preto"
                                        android:textSize="12dp"
                                        android:text="EM ATEND."
                                        android:padding="8dp"
                                        android:textStyle="bold"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:ems="10"
                                        android:id="@+id/txtRecursos"
                                        />
                                </LinearLayout>
                            </LinearLayout>



                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical">

                            <ListView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:id="@+id/lstOcorrencias"
                                android:divider="@null"
                                android:dividerHeight="0dp"
                                android:listSelector="@android:color/transparent"
                                />
                        </LinearLayout>
                        <LinearLayout
                            android:id="@+id/visivel"
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <LinearLayout
                                android:layout_marginTop="12dp"
                                android:layout_marginLeft="5dp"
                                android:padding="10dp"
                                android:orientation="horizontal"
                                android:layout_width="10dp"
                                android:layout_height="10dp"
                                ></LinearLayout>
                            <LinearLayout
                                android:layout_width="0dp"
                                android:layout_weight="8"
                                android:layout_height="wrap_content">
                                <TextView
                                    android:textColor="@color/preto"
                                    android:textSize="12dp"
                                    android:text="Outros (Demais Serviços)"
                                    android:padding="10dp"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:id="@+id/txtOut"
                                    />
                            </LinearLayout>
                            <LinearLayout
                                android:layout_weight="4"
                                android:layout_width="0dp"
                                android:layout_height="match_parent">
                                <TextView
                                    android:padding="10dp"
                                    android:textColor="@color/preto"
                                    android:textSize="12dp"
                                    android:gravity="center"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:text=""
                                    android:id="@+id/txtoutTotal"
                                    />
                            </LinearLayout>
                            <LinearLayout
                                android:layout_weight="4"
                                android:layout_width="0dp"
                                android:layout_height="match_parent">
                                <TextView
                                    android:gravity="center"
                                    android:textColor="@color/preto"
                                    android:textSize="12dp"
                                    android:padding="10dp"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:text=""
                                    android:id="@+id/txtoutEmAtendimento"
                                    />
                            </LinearLayout>
                        </LinearLayout>
                        <LinearLayout
                            android:background="#A9A9A9"
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <LinearLayout
                                android:layout_marginTop="12dp"
                                android:layout_marginLeft="5dp"
                                android:padding="10dp"
                                android:orientation="horizontal"
                                android:layout_width="10dp"
                                android:layout_height="10dp"
                                android:background="#A9A9A9"
                                >

                            </LinearLayout>
                            <LinearLayout
                                android:layout_width="0dp"
                                android:layout_weight="8"
                                android:layout_height="wrap_content">
                                <TextView
                                    android:paddingLeft="5dp"
                                    android:textColor="@color/preto"
                                    android:textSize="12dp"
                                    android:textStyle="bold"
                                    android:padding="8dp"
                                    android:text="TOTAL GERAL"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:id="@+id/txtTotalGeral"
                                    />
                            </LinearLayout>
                            <LinearLayout
                                android:layout_weight="4"
                                android:layout_width="0dp"
                                android:layout_height="match_parent">
                                <TextView
                                    android:textColor="@color/preto"
                                    android:textSize="12dp"
                                    android:gravity="center"
                                    android:textStyle="bold"
                                    android:padding="8dp"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:text="0"
                                    android:id="@+id/txtTotalQTD"
                                    />
                            </LinearLayout>
                            <LinearLayout
                                android:layout_weight="4"
                                android:layout_width="0dp"
                                android:layout_height="match_parent">
                                <TextView
                                    android:textColor="@color/preto"
                                    android:textSize="12dp"
                                    android:gravity="center"
                                    android:padding="8dp"
                                    android:textStyle="bold"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:ems="10"
                                    android:text="0"
                                    android:id="@+id/txtTotalGEmAtendimentoQTD"
                                    />
                            </LinearLayout>

                        </LinearLayout>

            </LinearLayout>

            </LinearLayout>
        </android.support.v7.widget.CardView>
</ScrollView>
    
asked by anonymous 20.02.2017 / 20:33

0 answers