Fairly new to Android dev. I am trying to create a HorizontalScrollView that snaps and filters images based on the centered object selected in a list. In the picture below, notice how the letter in the center of the screen should perform a set of specific commands. For example, when I scroll to "C" a popup with the message "C" should pop up.
I have created the HorizontalScrollView and populated the view with buttons. I am trying to figure out how to make it snap and how to identify the letter in the center at any given moment.
I have taken a look at ViewPager, but I don't think it will be able to do what I have described because I would like to have a set of letters displayed at any moment. I understand I will probably have to create a custom class. Could you provide any guidance?
Related
I am developing a resource for Machinists to use on their phone. It has lots of shop information in it. And I would like to include a calculator that can do a little bit of trig.
I am creating a button layout with all of the input keys, instead of using the android keyboard. I want to have two layouts side by side. The user will be able to scroll horizontally to get to one from the other.
Algeo, a great scientific calculator on Android, has an example of this. Algeo's keyboard is 3 different sets of buttons. And you can scroll horizontally between them. If you scroll halfway through two button layouts, it will automatically scroll it so one is centered. It will not let you scroll so you have 1/3rd of one layout, and 2/3rd's of another, or any other way you could split them.
I would like to know how to replicate this. I assume I need to use a container other than HorizontalScrollView, but, I'm unsure of what container it would be.
I'd like to implement a UI experience in Android where a user can view a single item (for example, an item in my case is a collection of texts), and swipe left or right on the item to go to the previous or next item.
From my research, ListView does not implement horizontal scrolling. Potential candidates seem to be HorizontalScrollView and GridView, but I haven't seen any examples that can do this simply - only seemingly complicated libraries that need to be included.
My question is, is there a way to use ListView, HorizontalScrollView, GridView, or a combination of them to implement a horizontal scroll that shows one item at a time and snaps to the item being displayed?
The highlighted area in the picture below shows where I'm trying to implement this logic.
It looks like the best option to achieve this experience is a ViewPager, which requires the android support library.
http://developer.android.com/reference/android/support/v4/view/ViewPager.html
I want to do following things:
1-Create a grid(Size is depend on number of image series) of images on one screen
2-When clicked/chosen a image.
3-second grid (Size is depend on number of image series) of images will be on screen.
4-Horizontal Swipe the first screen to next one to display the other grid(i.e remaining images)
5-When clicked/chosen a image on last grid, an image or layout will be on screen.
Similar to the Grid we see in our android Phone's
Any answer truly Appreciated...
Assuming I understand this correctly, you are probably thinking of a GridView, which takes an adapter to populate the grid with images, just like an adapter for a ListView populates the list with Textviews (or whatever you have in your custom adapter layout).
As for the support to select an image to go to another grid (subdirectories of images?) and swiping between various grids, this would be done using Fragments. For the subdirectory stuff, I don't know if there is an API somewhere to help with this, but if not you would need to implement a recursive tree structure: the internal nodes would define a point that can be selected to navigate to the next level, and the external nodes would be the individual images. Selecting an internal node would enter that subdirectory, and selecting an external node would open a second Fragment with the larger view of the image.
This is all a bit vague, but hopefully it gives you a place to start looking around. Read the developer docs on GridViews and Fragments to see if they help at all.
I have attached a screenshot of my app with some junk data. The white that takes up the entire ListView is supposed to only be for each item, creating a card layout. I am new to Android, and cannot figure out where my code makes the incorrect reference.
The layout for the individual card is here: http://pastebin.com/mxjiDTLF
The layout for the activity is here: http://pastebin.com/kstW9PqV
The EventAdapter.java class that displays the Event objects in the listview is here: http://pastebin.com/vXkBnPq0
Also, in the below screenshot, you can see that the scrollbar does not appear right next to the left edge of the screen, but just inside the "white" of the massive card. What do I need to do so that it does not appear there?
Most layout parameters are ignored for ListViewItems. You should wrap the contents in the list view item inside another layout that has the correct margins, something like here (not tested): http://pastebin.com/bW7s27in
The fact that your scrollbar is not at the edge of the screen is caused by the margins of the ListView in your activity_events.xml file. You should set those to 0.
You should set the card background to each item.
After getting solution to call my splash activity only one time (Part1 Question), Now i have to set up my splash activity.
On My First Layout i want functionality like this :
Image One <--> Image Two <--> Imgage Three --> Second xml(Activity)
Also on every image their will be a page control that will indicate on which image is currently on layout(Like the attached screenshot)/ or can be any other way to show this.
That Means From Image one i can go to image two on scrolling to right(I can come back to image one on scrolling to left) From Image two i can go to Image Three on scrolling right(I can come back to image 2 from Image three if i scroll to left)But if i scroll to right from Third Image then i should get to my Second Activity and never return back on those images.
i.e
I want to have scroll view having those three images with the page controller then after we scroll down to the third/last image on further scrolling to right i want that my second activity should be loaded and the splash should never come up.
Can any one tell me any idea how this can be done.
To make splash sheet with scroll view and page control & switch to second activity when done scrolling.
I don't want animation i want it to work manually like scrolling/ or any other way to implement this.
Coding will be much appreciated.
To implement scrollable images like shown above use ViewPagerIndicator library given HERE. Its simple to integrate and will take few minutes. All you have to do is read the usage section in given link.
For switching activity on last page, simply implement onPageChangeListener described in link and check for page number.