I'm developing an android app which is having 7 tabbed (slidable) fragments. I want to add a single scrollable background to these fragments. Searched a lot, but couldn't find a solution to this.
I want to have the same effect as that of a home screen in any launcher - When you swipe through different views the background also scrolls accordingly.
An example would be:
https://www.youtube.com/watch?v=uP91iN04kyc (# 1:17)
Pointers on how to do that are also enough.
I was thinking if we can have an image as background and set the x offfset and width of the image for every tabbed fragment, then we can achieve the same effect. Not sure if that will be the right approach or it is possible or not.
You need to add ImageView behind your pager.
Set its (ImageView) right margin to negative value (so the width of the image is greater than width of the screen)
Then register listener for pager scroll and set image view translateX accordinally.
Voila, scrolling background image.
Related
There are buttons from the service. I need to show these buttons according to the screen size. Buttons that do not fit on the screen should appear when you scroll to the right using the viewpager. How can I do that.
Sorry, I made the picture by hand.
I am looking for an android layout (if there exists) that can do the following.
2 images that occupies the entire width of the screen, stacked on top of each other. A slider say 2 or three pixels wide that allows a user to slide across the width of the screen revealing or hiding portions of the images.
Note that the layout like slidingPane does not work in this scenario as it resizes the contents in each pane rather than cropping them which is what I want.
To better describe the question here are some images.
Not really a layout, but achieves what I was after.
Added images to textureviews(1,2), added one of the textureviews(2) to a linearlayout. Added the texureView1 and linearlayout to a framelayout such that the linearlayout is on top. To achieve the above said effect the linearlayout and the textureView(2) that it holds is moved in opposite directions.
I have a working ViewPager app which renders an ImageView. This ImageView fills the screen in portrait mode but when the user orientates their device to landscape I wish to display the current ImageView on the left and the next ImageView in the sequene on the right.
Currently in landscape the ImageView is simply displayed in the centre of the screen.
I know that I have to define a res/layout-land version of the PageViewer layout, but more than that I don't know.
Is this possible?
Thanks,
Mark.
I don't think it is possible to display more than 1 view on a viewpager (doesn't matter if youre using horizontal or vertical orientation). What you could try is creating 2 viewpagers, but this may become confusing (updating the positions on both viewpagers.. as I assume you want to update the images like flipping through a book). Viewpagers are quite limiting in that sense.
You can try using a ViewFlipper, instead, which allows more flexibility.
i am trying to create the following UI in android app
In the above image all the five are to be image buttons. How to design this UI as like in the screen shot please help me friends....
Inside LinearLayout take RelativeLayout and make it centrally aligned.Then
Take first image Near me and set it's property.
Now take the second image Explore and set it to right of first image.
Place third image My network and place it below first image.
Fourth image Live set this to right of third image and and below second image.
Now center aligned your center image.
You will need to create 5 images, each of which has transparent areas. This layout type lets you position elements relative to the layout group itself, as well as to items within the group.
I'm not very familiar with Android advanced layout design, but the common layout objects give an idea:
There is a SurfaceView which gives you the ability to manipulate z-coördinates. In the SurfaceView you can then place a Grid/Relative/TableLayout for the 4 buttons (which you pre-render as rectangular images with transparency) and a simple Layout which centers and only contains the middle button.
If you then set the Z value of the first layout to less than that of the second you will get the view you want.
a picture is worth a thousand words, so my question should basically be self-explanatory with the attached image: How to get rightmost screen instead of the center screen?
turns out i cannot attach images directly yet, so i have to link to it right now:
How to get rightmost screen instead of the center screen?
just to add, i realise that it is not really possible to have the framelayout NOT expand as shown in screen 2b, but my question remains as to how to achieve such an overlay without pushing the Other layouts down i.e. the bottom part of the imageview would be on top of the top right part of the other layouts
perhaps you could have the image you are dynamically adding be outside the frame layout. ie have a relative layout contain both framelayouts and the imageview – jkhouw1 1 hour ago