ExpandableListview объединяет дочерний элемент и группу в одно и то же представление карты - PullRequest
0 голосов
/ 20 марта 2019

Хотите добиться слияния детей и групп в одном Cardview, используя Expandablelistview, как прикреплено как изображение.Я не хочу использовать расширяемый просмотр карт, так как вся моя функциональность готова, это будет стоить мне много времени. Предложите мне выход или библиотеку, с помощью которой это может быть достигнуто за короткое время.

list_parent.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="@dimen/_5sdp"
        android:elevation="@dimen/_10sdp"
        card_view:cardCornerRadius="@dimen/_5sdp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:weightSum="6.1">

            <ImageView
                android:id="@+id/actionIcon"
                android:layout_width="0dp"
                android:layout_height="@dimen/_30sdp"
                android:layout_gravity="center_vertical"
                android:layout_marginRight="@dimen/_5sdp"
                android:layout_weight=".5"
                android:tint="?attr/primaryColor"
                app:srcCompat="@drawable/ic_keyboard_arrow_down" />
        </LinearLayout>
    </android.support.v7.widget.CardView>
</LinearLayout>

list_child.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/border_primary_bottom"
        android:clickable="true"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/expandedListItem"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:gravity="center"
            android:padding="@dimen/_5sdp"
            android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft"
            android:text="FSU1"
            android:textColor="?attr/fontColorPrimary" />

        <LinearLayout
            android:layout_width="@dimen/_180sdp"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/_4sdp"
                android:clickable="true"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/tv_percentage"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="@dimen/_2sdp"
                    android:layout_weight="1"
                    android:background="?attr/blueColor"
                    android:clickable="true"
                    android:gravity="center"
                    android:text="54%"
                    android:textColor="?attr/whiteColor" />

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="@dimen/_2sdp"
                    android:layout_weight="1"
                    android:background="@drawable/edittext_background"
                    android:gravity="center"
                    android:inputType="number"
                    android:maxLength="4"
                    android:padding="@dimen/_2sdp" />

                <EditText
                    android:id="@+id/et_itc_inds"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="@dimen/_2sdp"
                    android:layout_weight="1"
                    android:background="@drawable/edittext_background"
                    android:gravity="center"
                    android:inputType="number"
                    android:maxLength="4"
                    android:padding="@dimen/_2sdp" />
            </LinearLayout>

            <TextView
                android:id="@+id/tv_deficit_val"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_25sdp"
                android:layout_margin="@dimen/_4sdp"
                android:layout_weight="1"
                android:background="?attr/greenColor"
                android:clickable="true"
                android:gravity="center"
                android:text=""
                android:textColor="?attr/whiteColor"
                android:visibility="gone" />

            <TextView
                android:id="@+id/tv_qualityof_facing"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_25sdp"
                android:layout_margin="@dimen/_4sdp"
                android:layout_weight="1"
                android:background="?attr/blueColor"
                android:clickable="true"
                android:gravity="center"
                android:text="Quality of facing"
                android:textColor="?attr/whiteColor" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

group view and child merge in a single cardview

Now the list is coming like this

...