Android align元素在expandablelistview的最后一个子元素下面

时间:2019-03-25 11:46:01

标签: android listview layout expandablelistview android-constraintlayout

在我的布局中,我有一个带有内部可扩展列表视图的滚动视图。在expandablelistview下面,我有一个按钮。

我想将按钮对准expandablelistview的最后一个元素。 展开可折叠列表视图时,一切正常,因为底部将在下面正确对齐。当展开时,botton失去连接,因为现在最后一个元素不再是最后一个组,而是最后一个孩子。

<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/COSMainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView"
android:fillViewport="false">


<android.support.constraint.ConstraintLayout
    android:id="@+id/generale"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp"
    android:focusableInTouchMode="true"
    app:layout_constraintBottom_toTopOf="@+id/constraintLayoutButtons">


    <!-- TITLE -->
    <android.support.constraint.ConstraintLayout
        android:id="@+id/constraintLayoutTitolo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="0dp"
        android:background="@color/primary_dark"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/riepilogoCantiere">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="8dp"
            android:gravity="center_horizontal"
            android:text="@string/questionario_label_title"
            android:textColor="@color/white"
            android:textSize="@dimen/fontsize3"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>

    <!-- QUESTIONS -->
    <ExpandableListView
        android:id="@+id/listadomande"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:choiceMode="none"
        android:groupIndicator="@drawable/questionario_group_indicator"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/constraintLayoutSottotitolo"
        />

    <!-- BUTTONS -->
    <android.support.constraint.ConstraintLayout
        android:id="@+id/constraintLayoutButtons"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/listadomande">

        <FrameLayout
            android:id="@+id/divider_buttons"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginStart="0dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="0dp"
            android:background="@color/primary_dark"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <Button
            android:id="@+id/invio"
            style="@style/COSButtonIcon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:background="@drawable/button_normal"
            android:drawableStart="@drawable/ic_subdirectory_arrow_right_white_24dp"
            android:paddingStart="15dp"
            android:paddingEnd="25dp"
            android:text="@string/questionario_button_label_invio"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/divider_buttons" />
    </android.support.constraint.ConstraintLayout>

</android.support.constraint.ConstraintLayout>

非常感谢您

0 个答案:

没有答案