While back I asked a question on adding clients to a listview, but I am wanting to transition it to gridview similar to this picture. They use textview and tablelayout, but it doesn't have to be that whatever is easier. http://sdroid.blogspot.com/2011/01/fixed-header-in-tablelayout.html would using textview/tablelayout, or is there better way of doing that?
I attempted to do it but it overlapped my header.. I forgot to save the code to show to see what I did wrong.
If I understand your question, you would like a fixed header displayed at the top of your screen. Below that, you would like a (scrollable?) gridview. Is this correct?
If so, than this is easy to accomplish. Use the FragmentActivity class (instead of the Activity class). Implement two fragments on your main page. An upper fragment will contain the header. The lower fragment will contain your gridview. They can both be displayed at the same time.
Related
I need to make a layout similar to that Image.
I wish it were shown all the registered images and their attributes and a button to add the user would select an image and define the attributes of it. I do not want a complete example that ordered but at least one direction than I use to do the layout. By my research I should perhaps use a swipe view. Has anyone seen something similar?
Thank you
You can use ViewPager to display cards like in top part.
ViewPager with previous and next page boundaries
And use a ListView or RecyclerView to show the bottom part. https://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465
In WeChat, it uses white sections for different things as you can see in below image there are three white sections in it and each item is separated by a black line:
I can suspect this is not a ListView as one might think in first glance.
Question: Does anyone know is this some built-in component that can be used or how to go about creating similar sections ?
I would say a linearlayout inside a scrollview with your custom listview and custom adapter is the most straightforward solution.
Each time the view is inflated you check the shared preference and fill in the info accordingly in your adapter. And on item click you open corresponding fragment/activity that do something. Then you issue a callback to refresh this settings view.
Might not be the most elegant way to do it. But I think this one is easy and clear.
I guess its a preferences activity/fragment but you can create it with a listview, linearlayouts or a combination of a scrollview and a linearlayout.
You have too many solutions ;)
I have a list view in which I want each list item will contain images. But the images will be displayed one at a time. SO, at a time for every list item only one image will be displayed. To view other images in the list item,one has to swipe horizontally. Is there any inbuilt widget that handles this in android?
EDIT1
My List item not only has Image but it also contains other views like textview, seekbar etc. So each list item will contain Image, textview, seekbar etc but the majority of the space will be occupied by the Image. Now, for each list item, when the image is swiped horizontally, another image has to be downloaded from a ulr and displayed.
EDIT2
I did a bit of research on ViewPager but many references like the answers here and this blog seem to suggest that using ViewPager inside a listview is not a good idea. Why is that? If it is not a good idea, what is a good alternative?
This problem can be solved by using ViewPager.
Link: http://developer.android.com/training/animation/screen-slide.html
ViewPager(for swiping between views) + UniversalImageLoader(for loading images from URLs, with caching etc)
If it is not, what is a good alternative?
I think you should use RecyclerView with LinearLayoutManager.HORIZONTAL. All things like recycling the views, view holder design pattern can be done easily with it and it is a new widget that google introduced and you can use it instead of ListView + ViewPager. because as you suggested it is not recommended to use viewpager inside listview. Although you can use horizontalScrollView but it dose not recycle the view. Other third party library like this exist but I recommend you use RecyclerView with LinearLayoutManager.HORIZONTAL because it is from google and it is normally tested more than people library. And another thing is you can use other layout manager like GridLayoutManager or having for example 3 rows that swiping horizontally or other good effects like adding animation and .... that google provided with RecyclerView.
For downloading the images you can use Picasso,Volley, Universal Image Loader or a lot of other libraries that exist.
Happy Coding :-)
Not sure I'm following you, but rather than a ListView wouldn't it be simpler to use ViewPager with simple Fragment that wraps a single image at a time. That way you get horizontal swiping "for free".
Do you just want swipe to change images? Or do you want the images to scroll as you swipe? For the former, you can just use a GestureDetector. For the latter you would probably use a ViewPager. See http://developer.android.com/training/animation/screen-slide.html
I have achieved the same functionality by using ViewPager, you can either put the SeekBar and TextView in the Fragment class off which you are gonna make multiple instances for each item and add to the pageradapter,
You can also add the TextView and SeekBar above the ViewPager Layout in your main fragment layout file and change the text and data on seekbar on viewpager's on item change listener, this looks more neat and this is the approach i've used
This is my first question in stack overflow. Please be liberal in validating it against the posting etiquette. which I am trying to adhere to.
I am attempting to create an android application for Honeycomb tablets, in which an activity loads a layout with fragments. Please see this image for better communication.
As seen that image, I have an activity running on emulated tablet. That activity has a listfragment on its left and and a fragment layout on right. The listfragment displays texts in a list. My need is that I have to have these texts in the listfragment to be aligned to right side of the fragment.
I had searched this site and many others but can find solutions about aligning an image on right of these text items in this list and not the text itself. I had attempted to use gravity property on the fragment and that too did not help.
Is this possible at all? Any suggestions on this will help me a lot.
Thanks,
Narayanan
In the layout that defines the list, the item's gravity property simply works fine.
For my next application, I'd like a ListView to form part of the app. Specifically, I'd like it to be the top half of the screen. Having looked through the documentation, I've only been able to find full screen list views, ie with the list taking up the full screen.
Is there any way of doing ListViews differently? I know there must be, but I'm unsure how to implement them myself. Does anyone have any pointers?
Just put the ListView in a container, like a LinearLayout or RelativeLayout, along with peer widgets. Like you see here.