Android create mosaic in row item adapter recyclerview - android

I want to create item adapter with a mosaic view include multiple images.
I found some libs: AndroidMosaicLayout,
QuiltViewLibrary.
But these show on the main view. In my case, I want to show images on the item adapter recyclerview.
It's same the row on facebook row new feed.
Any help, thanks.

You cam do it using the library AndroidMosaicLayout. In the layout used for the adapter of the RecyclerView just add the view of AndroidMosiacLayout and inside the recyclerview adapter, just inflate the layout resources and access the AndroidMosiacLayout normally by assigning the required layout pattern and data. At the end the AndroidMosiacLayout it is just a NestedScrollView, so you can use it the same way you use any other view or view group.

Related

Android Add custom items in costum ListView

I am creating a costum ListView
In this ListView I have the a list.xml with an item which has an image and three text fields.
Now to my problem :P
How can I add this custom ListView ITEM to my ListView (after a Button from another activity is clicked) and save it somewhere like in SQL...
Don't use ListView. Use RecyclerView instead.
https://developer.android.com/training/material/lists-cards.html#RecyclerView
You need to create adapter where you point proper XML file for an item
1. First, create a custom layout XML for your list row item(Image and 3 TextViews).
2. Create a custom adapter class to populate your ArrayList<OBJECT> on custom list row XML.
Here are some good tutorials:
Android Custom ListView with Image and Text
Android Custom ListView with Image and Text using Volley
Android Working with Recycler View
FYI, You can use RecyclerView instead of ListView. Android RecyclerView is more advanced version of ListView with improved performance and other benefits.
Hope this will help~

How about each item in the listview to add more data?

I hope above listview to add more data,Like the above picture.An item can display four data,Where and how much. Balance of time,I just need the local data, do not need to network data.What should I do?hele me.think!
(My English is not good. Hope you can understand what I mean)
you need to have a separate xml file file that provides the row layout to your listview. Try this tutorial on how to use list view.
Add recycler view dependencies on the app build.gradle file
Create an item view, and align views on xml of how a single list item would look.
Create recycler view adapter to inflate views and handle clicks
Add recycler view on your activity or fragment layout
From your activity or fragment, pass in data to your adapter using adapter's constructor.
In general just follow normal implementation of Recycler view. Click here so see example

Android ListView with only a single row of a unique view

I already have a ListView with a custom adapter for a custom view, and I'd like to add one more view that will only ever appear once in the list.
If I only ever need a single row of a special view in my ListView, is there a way to add it without modifying my adapter to handle multiple view types?
Or perhaps a layout trick that can hold the item and scroll as if the view was actually in the ListView?
You can use it by adding a headerView in listview
yourListView.addHeaderView(yourView);

android layout slider in custom listview

I have this row item in my custom list view, and in my array-adapter which I'm using to populate data in this list contains another list in each item. Which I want to show inside the layout out with arrows (shown in image above).
Any tutorial would be helpful
It sounds like you want a create your own View for each item in your listview.
This view would probably be a LinearLayout that you could programatically add new views to. Simply loop through your list within each item, generate the textview / image / whatever that you need, and add it to the linearlayout.
Note: your inner list can't be scrollable independently of the main listview.

android set adapter to linear layout

I am trying to put a list view in a scroll view which is not possible as I found in several similar questions.
I have a quite large menu to be placed above list view, which completely hides the list view on small screens, so I need a scroll view which is not possible. I read that I should use a linear layout instead of list view to solve this problem. But not sure how to setup up an adapter on linearlayout. I am using a lazy adapter for image loading in the list view.
Code:
LinearLayout list=(LinearLayout)findViewById(R.id.listActivities);
adapter=new LazyAdapter(this, activityList);
list.setAdapter(adapter);
As I understand from your question there is a single view that you wonna put at the top of your list view. Try to use ListView.addHeaderView(View v) for that purpose. See android API documentation for more info.
You can add a view as header to the list view, which will solve your problem, it will place the view in the list view but on the top of list items.
listview.addHeaderView(yourview)
you can add HorizontalScrollView in your listview header where in HorizontalScrollView you can add linearlayout & horizontal menus in it
or
other option is to have one simple button in header of listview say action & clicking on that open new dialog with list of menus (actions) etc...

Categories

Resources