Domanda

I'm trying to implement a ExpandableListView in java that when click deployment space elements inside, not the typical wish list allows choosing an option. What I try to do is basically something like this

enter image description here

One can see that the spinner "wraps" to have items and does not have a list, Would I could help a little?

È stato utile?

Soluzione

You can use ExpandableListView .. check this tutorial http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/

Altri suggerimenti

You can easily create one on your own. Just create a Button and assign a Layout below. When the Button gets clicked set the View of you Layout to Visible and otherwise to Invisible. Additionaly you can set up and down arrows to the right of your Button.

final Button button = (Button) findViewById(R.id.button);
        final LinearLayout linearLayout= (LinearLayout) findViewById(R.id.linearLayout);
        linearLayout.setVisibility(View.GONE);

        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if (linearLayout.getVisibility() == View.VISIBLE) {
                    linearLayout.setVisibility(View.GONE);
                    button.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.expand, 0);

                } else {
                    linearLayout.setVisibility(View.VISIBLE);
                    button.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.collapse, 0);
                }
            }
    });
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top