I want to use a vertical slide on my application so i implemented this library:
https://github.com/castorflex/VerticalViewPager
by adding implementation com.github.castorflex.verticalviewpager:library:19.0.1
in the dependencies of build.gradle.
Now i want to add this viewPager to my xml file (If it was native horizontal View pager i'll do in the layout something like <android.support.v4.ViewPager>)
But everything i try failed, what is the syntax to do it ? (never worked with libraries before)
I've tried <github.castorflex.verticalviewpager> too
Thanks
You have to put in your xml
<fr.castorflex.android.verticalviewpager.VerticalViewPager
android:id="#+id/verticalviewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Related
I'm new to Android development and I have to build an Android version of a iOs app. I have to build an horizontal menu in the bottom of the screen. Something like MOVIES|TV SHOWS|PERSONAL VIDEOS in this image
How do you suggest me to proceed? If I did an activity layout with a tabbed o linear layout at the bottom and fragments for the above contents?
#Ivan Lasorsa :
You can use ViewPager Fragment as main layout and for individual pager views we use Fragments. The tabs are part of Action Bar.
Swipe-view should consume the entire layout, then your layout looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
So please take a look Android Tab Layout with Swipeable Views Here . I hope it will helps you .
It's the tabbed activity, here is the doc ;)
I don't recommend bottom tab bar
because it causes the wrong touch
Pure-Android : http://developer.android.com/design/patterns/pure-android.html
but if you have to implement, you can read to
https://stackoverflow.com/a/7431480/2530660
Is there a way to use SwipeRefreshLayout to refresh ListView when it's pulled from bottom?
I created pull from top, but I would also need pull from bottom. There are many tutorials on how to create pull from top, but I couldn't find any tutorials for pull from bottom?
SwipeRefreshLayout from Android Support Library version 21 does not support pull from bottom.
I have made modification SwipeRefreshLayoutBottom with is based on original SwipeRefreshLayout code.
It is fully based on original Google code with just inversion of coordinates and overridden implementation of canChildScrollDown method. All modification are marked as TODO.
Bitbucker repository
Use this great library:
OrangeGangsters SwipyRefreshLayout
So you can swipe both from top and bottom and supports API 9+.
Library omadahealth/SwipyRefreshLayout must be the answer for your case.
Below Codes make your Recycler view pull up from bottom to refresh :
<com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/refresh_layout"
style="#style/View_MatchParent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:srl_direction="bottom"
>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
style="#style/View_MatchParent"
android:layout_height="wrap_content"
android:clipToPadding="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
</com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout>
I've encountered the same problem and I have solved it with a combination of swipeRefreshLayout and a touch event in my list. Here is the link:
https://stackoverflow.com/a/41701320/6144027
No, you can't do that with SwipeRefreshLayout. You need to implement your own layout, which is not that hard.
Check this
http://erikw.eu/open-source-android-pull-to-refresh-library/
and this
http://www.oodlestechnologies.com/blogs/Implementing-Pull-to-refresh-(like-in-Facebook-mobile-app)-for-ANDROID-using-Titanium
I'm trying to make default viewpager use vertical scrolling. And I'm stuck. I tried using Directional ViewPager
but it's kinda buggy and very laggy with vertical ori
Then i tried VerticalViewPager but i don't know how to use that. Replacing normal viewpager doesn't work. Any ideas how to implement Vertical View pager?
Edit: I also tried vertical view pager but this one working only in Android Studio, dunno how to use it in Eclipse, should i import project as a lib? or compile it to jar file and import as a lib?
Implementation of the compatibility library ViewPager class that supports paging both vertically and horizontally.
but you can choose to use a lib
Android-DirectionalViewPager
For a working implementation of this project see the sample/ folder.
Include the widget in your view.
<com.directionalviewpager.DirectionalViewPager
android:id="#+id/pager"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
By default the widget will page horizontally. You can alter this behavior by including android:orientation="vertical" in the layout or by calling setOrientation(DirectionalViewPager.VERTICAL) in your code.
In your onCreate method (or onCreateView for a fragment), bind to a PagerAdapter implementation.
DirectionalViewPager pager = (DirectionalViewPager)findViewById(R.id.pager);
pager.setAdapter(new TestAdapter(getSupportFragmentManager()));
ViewPager-Android
ViewPager, Based on the Android support library's ViewPager class, this ViewPager supports both horizontal and vertical paging views.
This ViewPager is a drop in replacement for the support library version. Simply reference the library and replace your ViewPager imports with this version.
Reference in your XML like this.
<com.ryanharter.viewpager.ViewPager
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:orientation="vertical"/>
Notice that you can use app:orientation="vertical" to easily set the orientation of the ViewPager to vertical. Orientation defaults to horizontal.
You can also set orientation in code using
mViewPager.setOrientation(ViewPager.ORIENTATION_VERTICAL).
I am trying to figure out how to make a swipe view without a tab layout.
In the figure above,
1. I want to make a swipe view that can navigate page left and right.
2. Icon 1 is a global menu that needed to be there all the time while swipping.
3. Icon 3 is a bottom bar. How can I make like that way?
Any kind of suggestions and tutorial links would be appreciated. Thanks in advance.
i don't have any links for the same,but still i will tell you the very simple logic to create:
1.First remove the title bar using
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
2.Use the following Structure
<RelativeLayout>
<ViewPager android:layout_height="fill_parent"
android:layout_width="fill_parent"> //full screen
<RelativeLayout android:id="#+id/header"> -->for header
android:layout_alignParentTop="true"
</RelativeLayout>
<RelativeLayout> -->for inicators
android:below="#+id/header"
</RelativeLayout>
<RelativeLayout> --> for footer
android:layout_alignParentBottom="true"
</RelativeLayout>
</ViewPager>
</RelativeLayout>
3.now make the images for header and footer and set as background.
4.for view pager indicator go Through This Post.just download it and import in your eclipse and set as a lib in your project. how to use circle pager indicator Check My Answer.
and you are done now!!
You can simply use for example a ViewPager as explained in the official documentation because it's not mandatory to have tabs.
http://developer.android.com/training/animation/screen-slide.html
There's a full example available in that link.
If you need also to display dots for your slides, you can take advantage of this library as pointed out by other users: http://viewpagerindicator.com/
Check this library I think this is what you need
and you can customize it as per your needs
https://github.com/pakerfeldt/android-viewflow
I want to put fixed-dimension buttons centred in a layout so that they automatically go to the next line when they are too many. But I know that this behaviour doesn't work with LinearLayout.
Do you have an idea on how I can proceed?
Here is the behaviour that I would like:
The Flexbox library from Google does exactly this:
Add the dependency to app/build.gradle:
dependencies {
implementation 'com.google.android:flexbox:2.0.1'
}
Usage of the layout:
<com.google.android.flexbox.FlexboxLayout
app:flexWrap="wrap">
<View/>
<View/>
<View/>
<View/>
</com.google.android.flexbox.FlexboxLayout>
I finally proceeded dynamically :
I created a LinearLayout for each line, and calculated the width taken by the rectangles compared to the global layout width to calculate the number of lines needed and to put each rectangle in the good line.
This is the GridView behavior.