在列表视图项中显示布局可见性

问题描述 投票:0回答:1

[这是我的listview项目xml代码。我有2个相对布局作为项目。我需要实现的是,在单击顶部相对布局时像下拉菜单一样设置底部相对布局的可见性。请帮助。谢谢。 。

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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="match_parent"
    android:id="@+id/constraintlayout">

    <RelativeLayout
        android:id="@+id/topLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
        <TextView
            android:id="@+id/IntDepName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000"
            android:layout_marginStart="36dp"
            android:layout_marginTop="30dp"
            android:layout_marginBottom="30dp"
            android:layout_margin="30dp"
            android:textSize="20sp"
            android:text="TextView"
            />
    </RelativeLayout>


    <RelativeLayout
        android:id="@+id/relativeLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="@+id/topLayout"
        app:layout_constraintTop_toBottomOf="@+id/topLayout"
        android:animateLayoutChanges="true">

        <TextView
            android:id="@+id/email"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000"
            android:gravity="center_vertical"
            android:drawableLeft="@android:drawable/ic_dialog_email"
            android:drawablePadding="10dp"
            android:padding="20dp"
            android:text="Send an Email"
            android:layout_marginLeft="30dp"
            android:textSize="15sp" />

        <TextView
            android:id="@+id/call"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:layout_marginLeft="0dp"
            android:textColor="#000000"
            android:layout_toRightOf="@+id/email"
            android:drawableLeft="@android:drawable/stat_sys_vp_phone_call_on_hold"
            android:drawablePadding="10dp"
            android:padding="20dp"
            android:text="Place a call"
            android:textSize="15sp" />

    </RelativeLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

到目前为止,我已经在资源中创建了动画并对其进行了夸大。但这仅适用于最后一个listview项,并且在程序启动后仅工作了一次。

android android-listview android-animation android-relativelayout listviewitem
1个回答
0
投票
对您有用吗?expandigview
© www.soinside.com 2019 - 2024. All rights reserved.