Reputation: 2445
I am beginner in the android development, can any one tell me how to expand a list when I click on an element of it say an image icon.
Upvotes: 3
Views: 4408
Reputation: 2445
This does it for me, due to privacy I can't write the whole code here
TextView desc = (TextView) v.findViewById(R.id.editText1);
ImageView icon = (ImageView) v.findViewById(R.id.listIcon);
if (desc.getVisibility() == View.VISIBLE) {
icon.getLayoutParams().height = heightIcon;
desc.setVisibility(View.GONE);
} else {
icon.getLayoutParams().height = LayoutParams.FILL_PARENT;
desc.setVisibility(View.VISIBLE);
}
Now when I click the icon, the text view placed below to it, becomes visible and thus has solved the question.
Upvotes: 2
Reputation: 40513
Here is the example code snippet to do it : ExpandableList1.java
You can even find it in your Android SDK folder
Drive:***\***\Android-sdk\samples\android-<apilevel>\ApiDemos\src\com\example\android\apis\view\ExpandableList1.java
Upvotes: 1