Warpzits's solution upgraded (expand any container content):
A layout XML:
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:clickable = "true"
android:focusable = "true"
android:orientation = "vertical"
android:gravity="end">
<ImageButton
android:id = "@+id/expandImageButton"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_margin = "12dp"
android:background = "#00ffffff"
android:src = "@drawable/dropdown_white"
android:onClick="onClickExpandImageButton"/>
<TextInputLayout
android:id = "@+id/container"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:visibility="gone">
<EditText
android:layout_width = "match_parent"
android:layout_height = "wrap_content"/>
</TextInputLayout>
</LinearLayout>
An onClick handler:
public void onClickExpandImageButton(
View expandImageButton) {
expandImageButton
.setRotation(
container.getVisibility() == View.GONE ?
180 :
0);
container.setVisibility(
container.getVisibility() == View.GONE ?
View.VISIBLE :
View.GONE);
}
Image from /res/drawable/:
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#f5f5f5"
android:pathData="M7,10 L12,15 L17,10 Z" />
<path
android:pathData="M0,0 L24,0 L24,24 L0,24 Z" />
</vector>