Is there any way to customize listview in android app development so that I can display few items in a curved/elleptical/cylindrical view.
Need to display a bunch of item in a scrollable view on top but the items are not in a straight line but as if placed on a symmetric curve???
I want to have a list view like this image
http://imageshack.us/photo/my-images/836/listview.png/
Sounds like you want/need a custom made list widget. You can probably accomplish what you're looking for if you dive into 3D with OpenGL
This cannot be done with the flip of a switch, but if you must have it, anything is possible.
As a starting point you could also look at the source for ListView
Related
I am new to Android and looking for advice on which particular view or views to use for an app. I am attempting to create an epg. I have done this on another platform and was wanting to migrate to android. After alot of reading and looking at examples I am little confused. To make a horizontal and vertical scrolling grid, would the gridview alone be enough to display the program titles. I say gridview alone, I mean the gridview in the main activity with a textview in resource xml. If not can somebody point me in the right direction, not asking for code just advice on the best way to go about the project. I am not worried about a channel list or time slot list only displaying the programming title in columns and rows that can scroll both directions. I anticipate the channel list being in a recyclerview separate form the grid. Thanks for advice.
I will suggest you to use cardview. Because gridview will give you 2 dimensional view which is not more customizable. Better you can go with cardview.
For cardview, you need to add dependency. You can use cardview inside recycler view.
GridView - GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a List Adapter. GridViews are particularly useful for displaying images in a structured fashion, for example if you’re designing a gallery app. To populate a GridView with data (whether that’s images, text, or a combination of the two) you’ll need to bind your data to the GridView using a ListAdapter
CardView - To create complex lists and cards with material design styles in your apps, you can use the RecyclerView and CardView widgets. CardView gives you an easy way of displaying data in Google Now-style cards. The Android SDK doesn’t include the CardView class, so you’ll need to add the CardView support library before you can use cards in your project.
To get bettter idea, you can visit this link.
I would like to render a list of drawables, side by side in a horizontal fashion, in a view in Android. I know a View has setCompoundDrawables, but that only allows me to add drawables to the left and to the right of a view. Is this the best way to approach this problem?
You can create your own customized view with Linearlayout (for a short list) or RecyclerView (for a long list).
For better answers, let figure out more what you want to implement!
I am trying to make a ListView for showing lyrics. I have very little experience with making custom compound views. So I would like to know what my approach should be to make this view. The ListView must have these features
auto-scrolling based on the song (the timing information will be stored in the list adapter)
highlighting the current line which is being played on the audio
indentation on some lines to make it look more like a nicely formatted poem
users should not be able to scroll the list when the song is playing (i.e. the list is being auto-scrolled) but it should be scrollable when the song is paused
I don't know if the view should extend list view or not. If not then what should it extend and what should be my approach?
Frankly, I really don't have enough information to answer this completely, but this is what I would do:
If it were up to me, since you don't want a scroll capability at all (you want to make it appear as if it is scrolling, not to actually allow the user to scroll), I would not use any of the complex views like ListView or ScrollView, I would just write a custom view, simply extending View. I would override it's onDraw() method and use Canvas.drawText(...) to draw the words, having two different Paints, one for the current word and another for all other words. As for the "scrolling" effect, you can keep a number that represents the current top line that you can see, and add one to this number when you want to scroll to the next line. However to make it smooth you can manipulate where exactly you start drawing the texts and move it slowly upwards, so that it would appear that everything is scrolling down.
** Maybe it would be better to use SurfaceView here instead of just View, especially if you want a background image and smooth blending and better a look, since SurfaceView is much better for complex drawings **
If that is too complicated for you and you want to use existing views entirely without doing any of the drawing yourself, I would recommend a vertical ScrollView, you fill the ScrollView with horizontal LinearLayouts for each line, and each of those is filled with TextViews for every specific word. You can programatically build the TextViews and the LinearLayouts. Use ScrollView's scrollTo(...) or SmoothScrollTo(...) to scroll to the right location. You can prevent the user from scrolling by capturing all the motion events before they are used to scroll.
Both approaches will of course require you to maintain some form of data structure to hold the times each word is selected.
I have an listview in my app, which displays list of images only. Now I want to add parallax effect for list items while scrolling the listview. I just now implemented listview only.
In a nutshell, you need to set a header to your ListView. This header will contain the image you want to apply a parallax on as well as the content that should go over (it usually is a classic ListView header but it could as well be something that looks like any element of your list).
The second main thing is to add a ScrollListener to your ListView, and create a custom ImageView (which overrides ImageView) that is able to receive how much your list has scrolled. In the onScroll callback, you can retrieve the first element of the list if it is visible, do a getTop() on it and send it to your custom ImageView.
You now have an ImageView that knows where it is on the screen even when your List scrolls. All you need to know is to translate the Y of your view (with either canvas.translate() or view.translate() depending on which SDK version you're working on).
I don't think it takes much more time than integrating a library and it works great!
I generally use ParallaxListView by Gnod. Check the below link
https://github.com/Gnod/ParallaxListView
How do i create this kind of views in my application?
(The screenshot is actually of an android application available in android market).
I am confused as i assume that we can create the same kind of layout either by using Gridview or by using ListView.
Problems:
In Gridview, can we give separator between two rows? can we give background to each row in gridview?
In Listview, i think we can customize the listview with 3 books in a row with background, and we can give a separator as well.
From your expert side, please suggest me a possible solution to design and create the same kind of layouts for the android application.
Look at the code of Shelves, written by Romain Guy (one of the ListView's creator).
He used a GridView:
no separator
background is a bitmap drawable
< bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/shelf_panel"
android:tileMode="repeat" />
background image is like this:
The code is worth a look because it contains other interesting solutions, too.
Stated problems:
In Gridview, can we give separator between two rows? can we give background to each row in gridview?
Well, you can always make up a separator by adding something on the bottom of your view. Make it so that it 'connects' on the sides, and you won't know the difference. It will cost you an extra view per grid-item, so probably not the best option.
In Listview, i think we can customize the listview with 3 books in a row with background, and we can give a separator as well.
Eeuhm, yes, although I don't see what the problem is?
With a ListView, each row is counted as an element, so there will be extra work in logic that keeps each item within the row separate. I would suggest you use a gridview. For each grid element, keep an empty shelf space (for one book) as the background image. This image will include the shelf-base. So there is no need for additional rows. The image should look like this:
I would instead suggest to have grid view and view flipper if the number of books are limited.
View flipper will give a better effect than scrolling.