CardView layout_height = "wrap_content" не работает внутри ExpandableLayout и ScrollView - PullRequest
0 голосов
/ 13 января 2019

Я пытаюсь поместить CardView в RecyclerView, но layout_height = "wrap_content" в CardView, похоже, не работает должным образом.

Это до Я удаляю тег ScrollView:

enter image description here

Это после я удалил тег ScrollView: enter image description here

из-за этого я предполагаю, что что-то не так с моим ScrollView, но я не уверен, что это такое.

Это код (с тегом ScrollView):

activity_order_detail.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="10dp"
    >
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/view"
        android:fillViewport="true">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <Button
                android:id="@+id/expandableButton6"
                android:layout_width="350dp"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="40dp"
                android:background="#2ACB6E"
                android:drawableRight="@android:drawable/arrow_down_float"
                android:onClick="expandableButton6"
                android:paddingRight="10dp"
                android:text="Detail Transaksi"
                android:textColor="#fff" />

            <com.github.aakira.expandablelayout.ExpandableRelativeLayout
                android:id="@+id/expandableLayout6"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/expandableButton6"
                android:padding="16dp"
                app:ael_duration="400"
                app:ael_expanded="false"
                app:ael_orientation="vertical">
                <android.support.v7.widget.CardView
                    android:id="@+id/card_view_transact"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:layout_margin="5dp"
                    card_view:cardCornerRadius="2dp"
                    card_view:contentPadding="10dp">
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_alignEnd="@+id/card_view"
                        android:orientation="vertical">
                        <RelativeLayout
                            android:id="@+id/transactLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <TextView
                                android:id="@+id/transactLbl"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBottom="@+id/transactInput"
                                android:layout_alignParentLeft="true"
                                android:layout_marginBottom="11dp"
                                android:text="Cara Pembayaran" />

                            <TextView
                                android:id="@+id/transactColon"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBottom="@+id/transactLbl"
                                android:layout_marginLeft="140dp"
                                android:text=":" />

                            <Spinner
                                android:id="@+id/transactInput"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_alignParentTop="true"
                                android:layout_marginStart="30dp"
                                android:layout_marginLeft="30dp"
                                android:layout_toEndOf="@+id/transactColon"
                                android:layout_toRightOf="@+id/transactColon"
                                style="@android:style/Widget.Holo.Light.Spinner"
                                android:gravity="left" />
                        </RelativeLayout>
                        <RelativeLayout
                            android:id="@+id/addressLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <TextView
                                android:id="@+id/addressLbl"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_alignParentTop="true"
                                android:layout_marginTop="10dp"
                                android:layout_marginBottom="11dp"
                                android:text="Alamat Pengiriman" />

                            <TextView
                                android:id="@+id/addressColon"
                                android:layout_alignParentTop="true"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBottom="@+id/addressLbl"
                                android:layout_marginLeft="140dp"
                                android:layout_marginTop="10dp"
                                android:text=":" />

                            <EditText
                                android:id="@+id/addressInput"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_alignParentTop="true"
                                android:layout_marginStart="30dp"
                                android:layout_marginLeft="30dp"
                                android:layout_marginTop="0dp"
                                android:layout_toEndOf="@+id/addressColon"
                                android:gravity="left"
                                android:textSize="15sp"
                                android:text="" />
                        </RelativeLayout>
                        <RelativeLayout
                            android:id="@+id/dateLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <TextView
                                android:id="@+id/dateLbl"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_alignParentTop="true"
                                android:layout_marginTop="10dp"
                                android:layout_marginBottom="11dp"
                                android:text="Tanggal Pengiriman" />

                            <TextView
                                android:id="@+id/dateColon"
                                android:layout_alignParentTop="true"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBottom="@+id/dateLbl"
                                android:layout_marginLeft="140dp"
                                android:layout_marginTop="10dp"
                                android:text=":" />

                            <EditText
                                android:id="@+id/dateInput"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_alignParentTop="true"
                                android:layout_marginStart="30dp"
                                android:layout_marginLeft="30dp"
                                android:layout_marginTop="0dp"
                                android:layout_toEndOf="@+id/dateColon"
                                android:clickable="true"
                                android:focusable="false"
                                android:gravity="left"
                                android:textSize="15sp"
                                android:text="" />
                        </RelativeLayout>
                        <RelativeLayout
                            android:id="@+id/isSentLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">
                            <CheckBox
                                android:id="@+id/isSent"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="Motor sudah diantarkan dan dibayar"
                                />
                        </RelativeLayout>
                    </LinearLayout>
                </android.support.v7.widget.CardView>
            </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
        </RelativeLayout>
    </ScrollView>
</RelativeLayout>

Можете ли вы показать мне, где я поступил неправильно? Спасибо.

...