Skip to content

jfatty/DropDownView

Repository files navigation

DropDownView

Partial Drop Down Full Drop Down

Add view to xml:

<com.anthonyfdev.dropdownview.DropDownView
        android:id="@+id/drop_down_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:containerBackgroundColor="#b71c1c"
        app:overlayColor="#64000000"/>

Bind views:

        dropDownView = (DropDownView) findViewById(R.id.drop_down_view);
        collapsedView = LayoutInflater.from(this).inflate(R.layout.view_my_drop_down_header, null, false);
        expandedView = LayoutInflater.from(this).inflate(R.layout.view_my_drop_down_expanded, null, false);

Set header and expanded views to DropDownView:

        dropDownView.setHeaderView(collapsedView);
        dropDownView.setExpandedView(expandedView);

Call expand or collapse:

        collapsedView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (dropDownView.isExpanded()) {
                    dropDownView.collapseDropDown();
                } else {
                    dropDownView.expandDropDown();
                }
            }
        });

Done!

About

A simple drop down view with built-in animations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%