0

As you can see in the image, this widget has a heading adjacent to a ^ symbol (^ Today in the picture), and the user clicks this heading, which results in opening(when the menu is not opened) or closing (when the menu is opened) of a kinda menu/other content below it.

Which GUI content is this?

I tried to Google it, but I couldn't find it, probably because of the lack of a proper search query. :s

enter image description here

Solace
  • 8,612
  • 22
  • 95
  • 183
  • 3
    "Which GUI content is this? " -- use **`uiautomatorviewer`** (or Hierarchy View, as this should be available on an emulator) and find out. I suspect you will find that it is an `ExpandableListView`, though it would not have to be. "if you can point me to some visual guide for Android GUI components" -- asking for off-site resources is considered off-topic for Stack Overflow. – CommonsWare Jul 13 '15 at 18:34
  • @CommonsWare Thank you. I just removed the part of the question asking for the off-site resource. I am sorry, I was not aware of it. – Solace Jul 13 '15 at 19:31
  • @CommonsWare "I suspect you will find that it is an ExpandableListView, _though it would not have to be._ " Are there any other options? So far I have decided for the an `ExpandableListView` with a custom adapter to have different layouts for different rows (which is a requirement), but if there is a better option, I'll go for it. – Solace Jul 13 '15 at 23:17
  • 1
    "Are there any other options?" -- sure. It's not like `ExpandableListView` is some magic black box or something. There are [a whole bunch of open source components with `expand` in their names](http://android-arsenal.com/search?q=expand), such as [this implementation of the expandable pattern with `RecyclerView`](https://github.com/bignerdranch/expandable-recycler-view). Not knowing your exact use case, I cannot say what alternatives may be better suited for you. – CommonsWare Jul 13 '15 at 23:40
  • @CommonsWare My use-case, actually I want to display a form in which the fields (which will take user input, like `EditText`, `Spinner`, `Date Picker`etc.) are divided into sections. So for better UX, I want only the section-headers (parent-rows in the `ExpandableRecyclerView`) to be displayed first, and then when the user clicks on one of them, it should expand to display the input controls (child-rows in `ExpandableRecyclerView`) under it. – Solace Jul 23 '15 at 05:01
  • @CommonsWare So far I was trying to use the [expandable-recycler-view](https://github.com/bignerdranch/expandable-recycler-view), but I need different child-rows to have different layouts. Found [this example](http://doublewong.com/2014/create-recyclerview-with-multiple-view-type/)understandable, but I need multiple view types for child-rows, not parent-rows, and it is the parent-rows whose data is passed to our `ExpandableRecyclerViewAdapter`. I [posted a question here](http://stackoverflow.com/questions/31578058/expandable-recyclerview-how-to-have-different-child-rows-which-are-displayed). – Solace Jul 23 '15 at 05:12

1 Answers1

1

An ExpandableListView should do the trick. (http://developer.android.com/reference/android/widget/ExpandableListView.html).

In your provided case, I would set the adapter to have one group view with as many child views in the group as you need. Each child group would need to inflate a layout with a checkbox, ImageView, and textview

wolfaviators
  • 503
  • 1
  • 7
  • 21
  • Firstly, thank you for answering. Secondly, what I am designing is not exactly identical to this. In the case of my application, there will be different kinds of `View`s under the heading. like `EditText`s, `TextView`s, `ImageView`s etc. I am essentially designing a `form` with different sections and I want each section to be expandable. – Solace Jul 13 '15 at 19:36
  • 1
    No problem. I hope I can help. To make sure I understand you correctly, you want a menu list that can expand to have elements that are not the same. For example. you can click on a title, you would expect a list to expand into visibility. On that list, you would expect to see see in the first element, a child that has for instance a checkbox and text. then in the second position,perhapse an edit text and a radio button, and so on. Is that correct? – wolfaviators Jul 13 '15 at 19:46
  • Yep. I am thinking about using an `ExpandableListView` and a custom adapter to have different layout for different rows. Just found [this](http://stackoverflow.com/questions/4777272/android-listview-with-different-layout-for-each-row). Am I on the right path? – Solace Jul 13 '15 at 19:52
  • 1
    You are on the right path. In a normal listview, you will have a method that will give you the view for the position in the list. public View getView(int position, View convertView, ViewGroup parent). In an expandable List, you will have a method for the group view and the child view. Following the patturn on the post on the child view will allow you to have different layout looks for children views at different position. I hope that makes sence. – wolfaviators Jul 13 '15 at 19:57
  • It does. Thank you so very much. – Solace Jul 13 '15 at 20:12
  • Hi, I could not work for quite some time. Now I have pulled off writing an ExpandableListView such that one header has one kind of children (like all textviews), and the next has different kind of children (e.g. all imageviews). But can you give me a hint on how to make it such that one header has multiple kinds of children e.g. first header has a child text view and a child imageview and a child spinner, then the next header has a child picker and a child textview... ? – Solace Aug 22 '15 at 23:56