Hello all i have a vertical view pager on the lower part of the screen ,
it works perfectly , from inside the part of the view pager ,
is there a way to control it from outside the viewpager ?
like if i scroll up from somewhere on the screen other than the viewpager it would still react to it
** note : the vertical view pager extends a viewgroup... **
thanks to all the helpers !
smackering said:
Hello all i have a vertical view pager on the lower part of the screen ,
it works perfectly , from inside the part of the view pager ,
is there a way to control it from outside the viewpager ?
like if i scroll up from somewhere on the screen other than the viewpager it would still react to it
** note : the vertical view pager extends a viewgroup... **
thanks to all the helpers !
Click to expand...
Click to collapse
I think maybe you need some code to catch your touches on the screen and scroll the viewpager dynamically by code depending on your touches.
That's the general idea or concept behind it i think but really i don't have a code example.
Related
Hi
I am using list view to display data in the screen, i am getting data from web service and i displaying the data in the listview. Its working fine.
Now the problem is i want to implement paging in the list view. For that i need to display only 5 records in the list view and once click the next/prev button it has to display another set of 5 records
I want to know how can display only five rows in the list view. and how can display next set of records while we click one next or prev button
any idea????
Thanks
mindus
How are you adding the rows? With an adapter? Can't you just limit your adapter to 5 views at a time?
Hi
Can u tell me how to do that? Or if u have any examples please share it
Thanks
mindus
You have to build a custom class derived from BaseAdapter, then you're free to do whatever you need to in your custom implementation of methods, namely: getCount() which tells the ListView attached to your adapter how many views to request.
Hi
I am working on android project. I have a list view screen where it displays various data fetched form web service. This list view has more than 150 rows. So i implemented pagination and its works fine (display 5 rows).
I am using simple adapter for this list view. Now i want on click on row it has to collect the data in that row and it should go to new screen. In the new screen click on back button it has to come back to the list view(old position: for eg the list view display 51 - 60 records, once i click on 56th row it has to go to new screen, when i click back button then list view has display 51 - 60 records not 1 - 10 records)
Any idea about this issue?
Thanks
mindus
How are you launching the next screen? startActivity()? Maybe try startActivityForResult()?
Hi
I am using startActivity.
I have the problem like that the list view screen has displayed 41 - 50 records. If i click on 45th record then it will show the next screen, and while clicking on the back button in the next screen then the listview screen shows the records form 1 - 10 records instead of 41- 50.
Can you please tell me how to rectify this problem?
Thanks
mindus
When you return from the activity started by the startActivity() call, the list activity will be reset by default and re-request data from the adapter. Use some means to store the state of your list, then when your activity returns, use whatever pagination scheme you have developed to signal the adapter to restore the page you were previously at. I don't know how you've implemented your adapter, so that's about all I can tell you right now.
Hi there, long time lurker first time poster here!
Slowly getting into android but i really cant get my head around the layouts. I would love to be able to use the AbsoluteLayouts but that isn't a good idea anymore.
Basically after some work i have managed to get a gallery working at the top of the screen. I want my app to look like this in essence: Ok can't post outside links at the moment, fair enough. Think of the android market. Icons to the left and a bit of information for each app next to it and a buy button on the right.
However i have no idea where to start off. Since i have the gallery already i have no idea how i can add things underneath it without screwing anything up.
Can anyone help? Thanks in advance!
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
RED_ said:
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
Click to expand...
Click to collapse
Are you using a List View? Looks like one.
How do you build up your content for the list?
In my view the best solution for your problem would be:
- Use a ListView
- Build your own ListAdapter (drived from BaseAdapter for example)
The Adapter builds the view for each item (or recycles an already built up view, the ListView handles that).
The view for each item would be a horizontal oriented LinearLayout with two items (the image and the text) and the adapter fills the layout with the information of the current item.
For better layout handling I would define the layout for the items in an extra xml file and use the LayoutInflater-Service inside the Adapter (if a view has to be built).
Hope this helps and points into a helpful direction
Devmil
Thanks for replying, managed to find a solution in the end without using ListView. Thought about moving to a RelativeLayout as its more effcient but as my app is very small anyway in the end i've just gone and used nested LinearLayouts with a textview and imageview in each one.
Ridiculously simple when you look back on it.
I was actually going to use this tutorial which does what you explained i think: http://www.anddev.org/iconified_textlist_-_the_making_of-t97.html but it left me with a force close error so that went out the window.
I am trying to develop a game that uses touch between multiple objects. I need to detect when multiple items are touched on one swipe of the finger. The game is similar to "Dots" if you have ever played it. So I need to detect when a dot is pressed and then from there when the finger is dragged to detect the next dot that is touched. I need to keep this going until the finger is lifted. Using dispatchtouchevent and viewgroups is on the right track I think, but that is the furthest I have gotten.
When you are tracking a single touch movement, all the events would be sent to a single view.
So instead of tracking touch events for each Dots, you should track touch events for the common parent ViewGroup.
Lets say you have a frame layout with all the dots places inside.
On ACTION_DOWN
create a Map<Rect, View> for all the dots, where Rect is the position of that view in the viewgroup,
Code:
Rect pos = new Rect(child.getLeft(), child.getTop(), child.getLeft() + child.getWidth(), child.getTop() + child.getHeight());
Essentially you need to create this map only once (and probably again after a relayout).
Then check which Dot was pressed using Rect.contains for each rect,
then on ACTION_MOVE,
Check if the same view was touched, and if not, again check for all the views to see if any other view was touched.
Dear users,
I am writing an app right now, which puts a floating window on top of every thing.
The only problem is, when i rotate the screen to landscape, the position of the window is all messed up.
If the position is here in portrait:
__________
|"-x-----------"|
|"--------------"|
|"--------------"|
|"--------------"|
|"--------------"|
__________
The position will be like this in landscape:
_______________
|"---------x------------"|
|"-----------------------"|
|"-----------------------"|
_______________
And the position needs to be like this:
_______________
|"-x--------------------"|
|"-----------------------"|
|"-----------------------"|
_______________
There is one thing i forgot to mention above:
The position of the window is fully dynamic, that means that the user can reposition the window when he or she wants too.
I really hope someone can help me out with this issue!
Thank you in advance,
Tim
well i would make a separate layout xml in folder layout-land then everything looks like you want it
That's impossible since the position of the window is set programmatically, and there is no way to set it using XML
tim687 said:
That's impossible since the position of the window is set programmatically, and there is no way to set it using XML
Click to expand...
Click to collapse
Then save the view's coordinates as floats relative to the screen width/height instead of dp or pixels and restore that position after the rotation (you only need to multiply it by screen height/width). Like so:
Java:
float posX = getX()/screenWidth;
float posY = getY()/screenHeight;