我想构建一个可扩展/可折叠的TableRow。我有两行,第二行上需要一个可扩展或可折叠的按钮(如小“ v”)。单击按钮后,我想用其他一些视图扩展第二行。我对android开发非常陌生,我不确定如何实现这一目标。这就是我目前所拥有的。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#4B0082">
<TableLayout
android:id="@+id/table_layout"
android:layout_width="370.0dp"
android:layout_height="350.0dp"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin">
<TableRow
android:background="@drawable/top_table_row_appearance">
<TextView
android:text="HNL"
android:padding="8dp"
android:textColor="@android:color/black"
android:textSize="15dp"/>
<TextView
android:text="LAS"
android:padding="8dp"
android:textColor="@android:color/black"
android:textSize="15dp"/>
</TableRow>
<TableRow
android:layout_marginBottom="5dp"
android:layout_weight=""
android:background="@drawable/tail_table_row_appearance">
<ImageView
android:id="@+id/image1"
android:src="@mipmap/ic_child_friendly_black_24dp"/>
<!--I want a collapsible button here. When I click it, this row should expand itself showing additional hidden views-->
</TableRow>
</TableLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
android:layout_alignParentBottom="true"
app:menu="@menu/navigation" />
</RelativeLayout>