Best practices combining lists and non-lists, such as Market

I am trying to solve a problem that many Android developers seem to have, which is to move lists with data from the list into one large scrollable panel.

The model I have in mind is the screen for a standalone application on the market. You have a great description, a list of several lazily loaded comments, and then some individual elements that do different things, for example, visit the developer's web page, call them, etc. And then between them all are good section headings.

Emulating this approach is extremely complex. I read SO answers and mailing lists well enough not to put ListView inside ScrollView, but I need the same effect without using addHeader () and addFooter () with very complicated header and footer views.

I tried using LinearLayout, which I myself have in the view, but I can’t get the nice click effects that have default list items (orange background, white for long press, etc.).

What should I do?

+3
source share
3 answers

Take a look at mine MergeAdapter, which is designed to handle such scenarios.

+4
source

? . . , ListView, . !

View headerView = getLayoutInflater().inflate(R.layout.header_layout, null);
ListView listView = (ListView) findViewById(R.id.my_list_view);
listView.addHeaderView(headerView, null, false);   

addHeaderView , . , .

+2

Source: https://habr.com/ru/post/1727925/


All Articles