I'm making a android app using Java, i want to make a 7 days schedule layout that can be moved horizontally centering the current day to the screen and each column can be scrollable and contains a list with a variable number elements, each element contains images and text; and if an item is selected has to open a layout showing more information about the selected element.

I don't know which is the best way to do it, i thought with grids or multi-list views, but I also don't know how to implement it.

Anyone knows a way to do it and some example? I have attached a design of how the layout would come to be in case anyone doesn't understand it.

http://i.stack.imgur.com/KZDuZ.png

Again, thank you all, i hope someone knows a way to do this elegantly.

Dani AI

Generated

Suggested architecture and quick plan

Use a single horizontal container (RecyclerView or ViewPager2) where each "day" is one page/item and each page hosts a vertical list for that day. That keeps one top-level adapter to manage days while each column still scrolls independently — cleaner and more efficient than seven separate ListView widgets. Snap the horizontal container so the current day centers (LinearSnapHelper / PagerSnapHelper) or use ViewPager2 if you prefer fragment pages. (developer.android.com)

Example wiring (Java, simplified)

RecyclerView outer = findViewById(R.id.outer);
outer.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
outer.setAdapter(new DaysAdapter(days));

// center selected day
new LinearSnapHelper().attachToRecyclerView(outer);

// inside DaysAdapter.onBindViewHolder(...)
RecyclerView inner = holder.innerRecycler;
LinearLayoutManager innerLM = new LinearLayoutManager(ctx, LinearLayoutManager.VERTICAL, false);
innerLM.setInitialPrefetchItemCount(4);
inner.setLayoutManager(innerLM);
inner.setAdapter(new EventsAdapter(eventsForThisDay));

// share a pool for better recycling across inner lists
RecyclerView.RecycledViewPool pool = new RecyclerView.RecycledViewPool();
outer.setRecycledViewPool(pool);

Prefetching and shared pools reduce stutter and allocation spikes when many inner lists exist. Use a single EventsAdapter class for rows and instantiate it per day, or reuse via stable IDs / DiffUtil for updates. (developer.android.com)

Touch, images and UX notes

Horizontal parent can steal gestures; have inner RecyclerViews tell the parent not to intercept vertical gestures (or detect axis and call requestDisallowInterceptTouchEvent accordingly). Load images with an async library (Glide/Picasso) to avoid UI jank and OOM. Also heed ’s UX caution: independently scrollable columns are fine technically, but validate the interaction with real users/devices. (developer.android.com)

Tie this to ’s current 7-ListView approach by replacing the seven ListViews with the above pattern, and use a background service / repository to populate the per-day lists (map date -> List<Event>) as suggested. Use DiffUtil/ListAdapter for smooth updates and SharedElement transitions or a detail Activity/Fragment for item taps.

Recommended Answers

All 5 Replies

Start an android project, then set up layout and images as you want them to be, then when it comes to the part where you'll have to design listeners and changes, you can ask spesific questions, otherwise don't think anyone in here would just sit and write the code for you

Hi Slavi, i don't want the code, i just don't know how can i do what i want.

for example, if i ask how to do a listview with text and images: i hope someone tell me that i have to use a ListActivity that uses a layout that have a ListView and then using an adapter load the information into a layout that contains every row of the list.

I only seek guide, and i'm sorry if my question seems that i want to someone write the code for me, it's not the case.

Thank you anyway for your answer.

Trying to re-invent the wheel
Did you check out default Android calendar? Would be good start and think why they di it this or that way.

Having multiple columns that are scrollable separatly is just bad idea.

If you still insist on re-inventing wheel then try to build around designs of existing Android calendar

I have tryed that already, but since i only need 7 days and i want to put images and several text lines and more things like that it's very difficult with my knowledge.

Now i have a layout with 7 ListView, but i don't know how to populate the ListView using one single adapter, i have searched examples, but i didn't find anything yet

Thank you for your help Peter_budo.

Without knowing more about project, code wise, it will be hard to advise. Nevertheless it is obvious you need to create "a service" that will be querying whatever storage you decide to use in order to fetch existing appointments and push it to specific day listview

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.