Comments (12)
Which pages do you want to restrict access to?
from flippablestackview.
The pages should be available.
The user should not be able to swipe away a particular page to access the next page.
Changing of pages is done programmatically.
from flippablestackview.
Ok, so if changing of pages is done only programmatically, then the only thing you need to do is to disable touch in the FlippableStackView
(hint: it's just a ViewPager
). You can do that for example by extending FlippableStackView
and applying the mechanisms from here.
from flippablestackview.
I have tried to use the setOnTouchListener()
flippableStackView.initStack(4, StackPageTransformer.Orientation.HORIZONTAL);
myadapter = new CustomAdapter(questionArray, posPointArray, negPointArray, getSupportFragmentManager(), viewPagerFragments);
flippableStackView.setAdapter(myadapter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
flippableStackView.setCurrentItem(0);
}
flippableStackView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});`
But it doesnot seem to work. I can still swap from one page to another.
from flippablestackview.
Use the one approach I sent you in the link (you will have to extend the FlippableStackView
).
from flippablestackview.
I fixed it by using this line before returning true from the onTouch() function flippableStackView.setCurrentItem(flippableStackView.getCurrentItem());
from flippablestackview.
That's interesting that you used the least reliable of the approaches from the StackOverflow thread (look at the first comment under the answer), and you used a random "solution" to make it barely work, instead of just going with a simple, elegant and solid solution (the one I pointed you to). Out of curiosity: why didn't you try the other approach?
from flippablestackview.
I couldn't use the better solution, because I can't extend the
FlippableStackView class. I am already extending the AppCompatActivity
class.
I actually have no idea how can I implement the way as u have mentioned.
On Fri 23 Sep, 2016, 7:29 PM Bartek Lipinski, [email protected]
wrote:
That's interesting that you used the least reliable of the approaches from
the StackOverflow thread (look at the first comment under the answer
http://stackoverflow.com/a/13392198/1993204), and you used a random
"solution" to make it barely work, instead of just going with a simple,
elegant and solid solution (the one I pointed you to). Out of curiosity:
why didn't you try the other approach?—
You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub
#24 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AO7EUe8g2Z9_XCel_hWlp5QlCFcZCfshks5qs9s7gaJpZM4KEyHF
.
from flippablestackview.
You should've just said that you're not sure how to extend a FlippableStackView
class, I'd be happy to help you with that. Just create another class
in your package, name it e.g. DisableableFlippableStackView
and use the following code as it's contents:
public class DisableableFlippableStackView extends FlippableStackView {
private boolean pagingEnabled;
public DisableableFlippableStackView(Context context) {
super(context);
setupView();
}
public DisableableFlippableStackView(Context context, AttributeSet attrs) {
super(context, attrs);
setupView();
}
private void setupView() {
this.pagingEnabled = true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (this.pagingEnabled) {
return super.onTouchEvent(event);
}
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (this.pagingEnabled) {
return super.onInterceptTouchEvent(event);
}
return false;
}
public void setPagingEnabled(boolean enabled) {
this.pagingEnabled = enabled;
}
}
And use DisableableFlippableStackView
instead of FlippableStackView
in your layout xml.
from flippablestackview.
Thank you so much
It worked!!!!
from flippablestackview.
👍
from flippablestackview.
👍
I need your help,How to dynamically set the page only up or down?Thank you
from flippablestackview.
Related Issues (20)
- Include it with scale Animation HOT 1
- How can I remove space from left and right of cards. It is leaving space on both ends
- Init with gravity does not react on Lolipop 5.0.1 HOT 1
- Crashed on android 6.0 HOT 2
- Infinite loop HOT 1
- Move items programatically HOT 2
- Stack Position changing HOT 1
- After Pagination, few cards go invisible, but yet swipeble.
- Few cards not visible.
- How to make views appear from the bottom? HOT 1
- StackAlways Aligned Center HOT 1
- How can i set selection at particular index. HOT 6
- How to set display top stack but swipe to right? HOT 1
- PageChangeListener not available? HOT 1
- StackView Position issue HOT 2
- Not working inside scroll view
- Any function to disable swipe? HOT 2
- How to set Image Instead of the colors HOT 1
- Implement infinite scroll. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flippablestackview.