Suppose i want to make a view like as given below image
Is it efficient to have a custom list-view for this or a simple linear layout with elements which can be inflated and added to another layout. I do not want to have any click operation over the items, i just need to show them over a screen. Which one will be better approach?
I already know how to make Custom ListViews
Related
Am trying to create a page with a scrollable list. Features would be a normal list to remove item by clicking on it. Number of items in that list are limited and added dynamically by user. You can consider a to do list as example. Now which would be a better approach to implement it? Recycler view with data bound to its adapter? Or the normal linear layout with items added as children at run time?
My current implementation is recycler view. But,I found it lagging and animations are not performing well. So a linear layout is auto animated by specifying it xml -- by setting animate layout changes to true.
FYI data is local and syncs in background.
Never use a LinearLayout for anything longer than a single screen. The whole point of ListView and RecyclerView is to efficiently reuse views instead of needing to hold things in memory when they're not visible. Maybe you can refine or reask your question so people can help you with whatever difficulty you're having with animations, rather than avoiding the issue.
I want to implement the below image in android ,
I have used Relative Layout to display content and Recycler view to display comments but I want both under one scroll while my problem is recycler view is creating another scroll.
I also thought to add a layout dynamically but in that every layout I have to implement click listener for every child , which is not good for performance
What could be the best way to implement it
You can make a ListView where row contains Comments part and add Image as a Header of that ListView.
The other way is to create a Custom Adapter and include Image and Comments as a single row of a ListView
For implementing a click event on each item you can refer to this answer
Why don't you use a ListView with custom elements in it (that look like the comments on the picture) instead of the RecyclerView
I have a button. It calls another activity with custom listView, that contain images and checkBoxes, marked positions are passed to another activity. It's works well, but I need that retrieved several icons to be displayed in a row into the button, as shown:
create a xml file named row_lauout.xml and use LinearLayout in it with orientation horizontal and arrange all your button in that.
in your main.xml create a List and aligned it as per your design.
in java code write a class called ListAdapter which extends either BaseAdapter(or any other adapter based on your need) and override getView method.
inside getView method inflate row_layout.xml as
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_layout,
null);
then implement onClick for all buttons in getView method.
one more suggestion search for cell reuse concept in android. it will help to make scroll very smooth.
Put ImageViews in a LinearLayout? Your question is really hard to understand, but if I take it at face value that's your answer.
In your XML layout, use a LinearLayout with a Horizontal orientation.
The items that you place within the container should have a fixed width or set to wrap_content
I need to make a scrollable row in ListView's item. The row should behave similar to Gallery or ViewPager. It was designed to behave similarly to Facebook gallery.
I was planning to use Gallery but since it has been deprecated I'm not sure if it's a good choice. Although Fragment is recommend to be used to replace Gallery, it's not expected to be put inside a ListView.
Is there other options for available? Or should I implement my own custom view to calculate and handle the view transition? Has anyone try something similar?
Make the row item a HorizontalScrollView with a LinearLayout inside.
Make the LinearLayout's oriantation horizontal and add the things you need inside.
I have a gridview of images in android. When i click any item on it, i want to show a new set of items over it. This is the screen shot .
Can this be done using gridview? Also what should be the type of view which must come over the gridview? The background should become preferably faded.
I am not so sure if you can achieve the second view using a grid view. In the grid view AFAIK you don't have any option of specifying the location of the grid elements. It just arranges it from left to right and wraps around.
But here is how I would do it -
First view can be done using the grid
view, as you already know/done.
For the second view since you want the the first view to remain in the background, there are two ways to go about this -
First option
You can use a dialog, you can create your own custom dialog which has makes it translucent.
In this custom dialog you can add further elements like images.Custom dialog example. For details on how to make it translucent you can look the sample app in android sdk.
Second option -
Use a layoutInflater. Put all your views into it.
You can display one view on top of another using the visibility attribute of the view. Layout Inflater