Android Gridview with a external scrollbar - android

I have a gridview with some objects inside it and I have an alphabetic list that is compose by a lof of textviews.
I want to click on "A" and the gridview is going down until the letter "A" and the same with the other letters.
Maybe that won't be a problem but the big problem is when I scrolling the gridview, I want to know which items are display and try to get the first item to decide which letter is it.
That look like the iphone contact

There's a very similar situation addressed here:
How to implement scrollbar with thumb for fast scrolling
I'm pretty sure that's exactly what you want.

Related

List of buttons

I got 100 ImageButton, I need to make a list of these button, I tried with a static list like the scrollview, It work but the app need 4 to 5 seconds to load all the ImageButtons, so I want to try to make a list that load buttons when user scroll down. In this way the app does not have to load all the buttons at once, I've been looking for a solution for days but I can not find it, someone know how to achieve this list of imagebutton?
You should use ListView or RecyclerView. I recommend starting with some lessons:List view. Ask if you will have some problems.

Is it possible to put a ListView that doesn't scroll inside of a scrollview?

I got a scroll view. I need a list of items inside the scrollview.
I thinking of using a listview and somehow make it display all items and have the scrollview scroll through them.
I think i will run into scrolling problems so my question is, is what i am doing something that is usually done sometimes? if so whats the best way of doing it if not how else should I have a list of items in a scroll view. do I need to create views pro grammatically as I fetch them? it sounds inefficient

Android ListView for showing lyrics

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.

ListView with a (half- and or) hidable header

My Problem, is that I don't even know what to search for.
I want a ListView.
This ListView has some Elements with a "sticky" state.
If I scroll down the List on the device, I want that all ListElements with state "sticky", to be sticky ontop of the list (non-scrollable) till there is another one "pushing it away". The rest of the elements are supposed to scroll as normal.
I've seen that kind of List in the Google Market. If you have a big screen you can see that list on the Detailview of any app on the left side or if you have android JB, the same effect is on the google search bar in the google now app.
Image One: You can see the normal ListView on the left side
Image 1 http://www.android-hilfe.de/attachments/android-app-entwicklung/120884d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste1.png
Image Two: You can see the normal ListView scrolled up a bit
Image 2 http://www.android-hilfe.de/attachments/android-app-entwicklung/120885d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste2.png:
Image Three: You can see, what I actually want. The View is scrolled up but the "sticky" price does not disappear. Instead of that all other elements, went under the "sticky" one
Image 3 http://www.android-hilfe.de/attachments/android-app-entwicklung/120886d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste3.png:
How do I do that?
I think that you meant to do some "synchronized scrolling".
There's a great post explaining how they've done in on Google Play:
http://www.pushing-pixels.org/2011/07/18/android-tips-and-tricks-synchronized-scrolling.html
Hope that's what you were looking for..
I believe that is a separate component, not related to ListView in any way.
Just create the header, let it be a RelativeLayout, or LinearLayout, and fill the rest of the area with the ListView set to fill_parent. Then, when you'll scroll the ListView, the "header" will stay sticky (as it is a separate component), and the list will scroll down.

Large number of TextViews a performance hit? Should I switch to ListView instead of using Scrollview?

So I have a screen that displays a grid (TableView where each TableRow is mostly TextViews) like a scorecard, with like 8 rows and 11 columns.
I'd like to add about 10 more rows to it, and keep it in a ScrollView. But I'm wondering if I should switch the whole thing to a ListView.
So assuming that half my grid is "off screen" is there a big performance (rendering time, memory usage) hit to just using the ScrollView? Or would I be better off going to a ListView?
Basically I just don't want the thing to lag when it displays the screen for the first time (or during scrolling).
Thanks.
I would use a ListView... It's so comfortable
With a ListView you can easily manage the selected rows. And with the right Adapter you can also write a very efficent List.
You can find a few examples in the Android API Demos
Using ListView and ListAdapter, there is a lot that is done under the hood to ensure that it is efficient, for example, the displayed list items are reused when scrolling rather than creating one for every item.
So yes, I would suggest using ListView along with ListAdapter.

Categories

Resources