I wanted to created ViewPager with Parallax effect in which will be indicator. I am just beginner so i tried to use this library form GitHub https://github.com/prolificinteractive/ParallaxPager
I did everything by instruction, but it didn't work. Can anyone explain me how to do it?
1. I added this project to my project.
2. I Used a ParallaxContainer in my main layout XML.
3. For each page i created new layout XML files as in instaction. I added this line for each of them xmlns:app="http://schemas.android.com/apk/res-auto" , but its mistake everywhere in which was word app. app:x_in="#dimen/parallax_speed_slow" etc. Mistake was like "Unexpected namespace prefic app found for tag ImageView"
4. Find the parallax container by ID, Specify whether the pager should loop (true means it will loop),Submit a Layout Inflater and list the layouts for each page (in order). Currently there must be at least 2 in this list (repeats allowed).
5. In this Activity i added this method attachBaseContext to as in instaction
At the end when i test it in emulatore nothing happened. What i missed to do. What`s wrong here? Another problem is indicator as you see. Can anyone show me how to make parallax effect in viewpager or you have another good examples?
Related
So, first of all I'm very new to Android so this may be a very dumb question, but..
I have in my mainActivity layout a viewPager which calls some fragments of different type (I have made 4-5 xml layout displaying different informations)
Despite I created all the layout basing on weighed LinearLayout to maximize compatibility, in the preview the visibility seems perfect in each device I selected, but once I load the application on my phone, the layout has bizarre behavior.
Here an example (preview vs. screenshot from my device)
I'm not sure about where I made the mistake, I would like to know:
1) What happened
2) What cause this behaviour
3) How to fix it (a link with a guide would be very welcome)
Thanks very much!
Each time when I am trying to write layout xml file for ViewPager, I have to write it manually.
autocomplete works fine for TextView, EditView and all other views, however it does not work for ViewPager, or for PagerTitleStrip, and maybe for other views in support libraries.
the bellow screenshot shows that I don't have choices to autocomplete ViewPager.
I tried to add android-support-v4.jar to build path, but this is not work too, and I think it has no related with this issue.
so what is the problem with autocomplete for views in android.support.v4 ???
any suggestions ?
I'm using a ViewPager to host multiple views, and I want something to visually show where the user is currently located. I don't want to use PagerTitleStrip or PagerTabStrip cause I don't want titles.
I want something similar to the horizontal line in the default launcher of the Nexus 4 shown in here:
When you swipe left or right, there is a slightly bigger rectangle that shows your position relative to the pages.
How can I do this?
PS: I can't use any library cause the code is going to be written in C# with Xamarin, also can't use any Xamarin component cause license won't let it have any more components.
Use the ViewPagerIndicator Library. This has an option for your desire.
ADDITION
I found this official Xamarin ViewPagerIndicator Library. Maybe this would help.
I've been updating an Android app today which so far had a single TableLayout-based View. Now, I'd like to duplicate that View with another set of backing data, and use horizontal swiping to switch between both. At some point I'd also like to add a third "page" with a different TableLayout.
I haven't really found any good ways to get this going. I've been looking at http://developer.android.com/training/implementing-navigation/lateral.html, and I actually copied the code fragment for the Tabs Pattern with NAVIGATION_MODE_TABS. That results in a little dropdown widget being added to the View title in the action bar, but clicking it doesn't show the tabs I set up (with actionBar.addTab()). I'm also not sure how to set up the view (XML) code to stick the TableLayouts in there.
I should mention that I don't have to care for pre-4.0 Android for this, so compatibility is not (much of) an issue.
Try to Use ViewPager Widget you can find useful links on the web, this widget handle the horizontal swiping between views.
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
https://github.com/JakeWharton/Android-ViewPagerIndicator
http://blog.stylingandroid.com/archives/537#
I haven't really found any good ways to get this going.
Try ViewPager. Here is an Android Developers Blog post on ViewPager: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Here is a small sample app using ViewPager: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/Fragments
None of the other answers ended up helping much. However, this one is pretty good:
http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/
I am a new android developer, just tried something with Android Tablayout.
There are two tabs and one tab has a GridView and the other one has a DatePicker.
I created an activity and layout for each tab.
The problem is that when I switch to the gridView, the background is not refreshed, and the images are just drawn over the DatePicker, so through images, the DatePicker still can be seen. It really bothers me.
What should I do to have a clean background for imageView?
Steve
There is something wrong with your layouts if you are seeing that behavior. Here is a sample project showing multiple activities as the contents of tabs. Here is another sample project that takes the more efficient approach of just using Views as the contents of tabs. Hopefully, by examining these, you can see where things may be going wrong with your layouts.