Android: Default layout for listitem containing title and subtitle

Xander picture Xander · Mar 13, 2013 · Viewed 12.5k times · Source

I have made a listitem, containing a title and a subtitle. Looking to the result, I think it doesn't look really professional. So that's why I'm asking.

The listitem I'm looking for is pretty common (it's used in a lot of apps i.e. Android's default settings menu and it's also shown when you add a listview in the graphical layout editor tab in eclipse).

So my question is: Where can I find a default layout for a listitem with a title and a subtitle?

Answer

Mykhailo Gaidai picture Mykhailo Gaidai · Mar 13, 2013

Resource id is android.R.layout.simple_list_item_2

Upper text line has id android.R.id.text1 and lower one - android.R.id.text2

Layout is located in the <ANDROID_SDK_ROOT>/platforms/<any_api_level>/data/res/layout folder

OR

You can use TwoLineListItem from the default Android controls list(it is located under "Advanced" tab in Eclipse Layout Editor)

OR

You can build your own layout with anything you like(for example LinearLayout with orientation="vertical" and two TextEdits added