मैं शोफ्लिचर पर जेस्चरडिटेक्टर का उपयोग कर रहा हूं, शो को स्पष्ट करने और शोनेक्स्ट को लागू करने के लिए। सबकुछ ठीक है। हालांकि, मैं प्रभाव चाहता हूं कि व्यूफ्लिपर एनीमेशन तुरंत इशारा करने के बजाए उंगली इशारा करता है। कोई सलाह?एंड्रॉइड व्यूफ्लिपर जो तुरंत संकेतों का पालन करता है
7
A
उत्तर
5
जहाँ तक मुझे पता है कि आपको इसे मैन्युअल रूप से करना है। नीचे दिया गया कोड आपको सही दिशा में इंगित करना चाहिए। आपको गतिशील एनिमेशन जोड़ना होगा ताकि दृश्य फ्लिप के दौरान फ्लिकर न हो। व्यूफ्लिपर में सामग्री के आधार पर आपको और करने की ज़रूरत है, लेकिन इसे शुरू करना चाहिए।
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
{
//Gets the startpoint for you finger
pressDownPoint = event.getX();
//Gets how many view there is in the viewflipper
flipperViewCount = flipper.getChildCount();
//Checks if there is a view to the left of the current view
//if there is, it positions it to the left of the current view
if (flipper.getDisplayedChild() > 0)
{
View leftChild = flipper.getChildAt(flipper.getDisplayedChild() - 1);
//You must set the left view to invisible or visible
//or it will not move to the position you tell it
leftChild.setVisibility(View.INVISIBLE);
leftChild.layout(-screenWidth,
leftChild.getTop(), 0,
leftChild.getBottom());
}
//Same as above but for the view to the right
if (flipper.getDisplayedChild() < flipperViewCount - 1)
{
View rightChild = flipper.getChildAt(flipper.getDisplayedChild() + 1);
rightChild.setVisibility(View.INVISIBLE);
rightChild.layout(screenWidth,
rightChild.getTop(), screenWidth * 2,
rightChild.getBottom());
}
break;
}
case MotionEvent.ACTION_UP:
{
//Gets the absolute position on the screen
float releasePoint = event.getRawX();
//Calculates if the fling is to the right or left
//The screenDensity variable is simply the density of the device
//Have in mind that this will not flipp the viewflipper if you drag
//your finger less than about 0.5cm (depeding on the device)
//In that case you need to make an animation that takes the view back
//to its original position. Else it will just get stuck where you
//let go with your finger.
if (Math.abs(pressDownPoint - releasePoint)/screenDensity > 30)
{
if (pressDownPoint > releasePoint)
{
myAnimLeft(); //Method with your animation
flipper.showNext();
}
else
{
myAnimRight();
flipper.showPrevious();
}
}
break;
}
case MotionEvent.ACTION_MOVE:
{
View currentView = flipper.getCurrentView();
//Moves the current view
//screenWidth is based on the current devices screen width
currentView.layout((int)(event.getRawX() - pressDownPoint),
currentView.getTop(), (int)(event.getRawX() - pressDownPoint) + screenWidth,
currentView.getBottom());
//Moves the view to the left if there is one
if (flipper.getDisplayedChild() > 0)
{
View leftChild = flipper.getChildAt(flipper.getDisplayedChild() - 1);
leftChild.layout((int)(event.getRawX() - pressDownPoint - screenWidth),
leftChild.getTop(), (int)(event.getRawX() - pressDownPoint),
leftChild.getBottom());
//Sets the left view to visible so it shows
if (leftChild.getVisibility() == View.INVISIBLE)
{
leftChild.setVisibility(View.VISIBLE);
}
}
//Same as above but for the view to the right
if (flipper.getDisplayedChild() < flipperViewCount - 1)
{
View rightChild = flipper.getChildAt(flipper.getDisplayedChild() + 1);
rightChild.layout((int)(event.getRawX() - pressDownPoint + screenWidth),
rightChild.getTop(), (int)(event.getRawX() - pressDownPoint + (screenWidth * 2)),
rightChild.getBottom());
if (rightChild.getVisibility() == View.INVISIBLE)
{
rightChild.setVisibility(View.VISIBLE);
}
}
}
}
return true;
}
संबंधित मुद्दे
- 1. एंड्रॉइड व्यूफ्लिपर
- 2. एंड्रॉइड व्यूफ्लिपर एनीमेशन
- 3. व्यूफ्लिपर
- 4. व्यूफ्लिपर बनाम एडाप्टर व्यूफ्लिपर
- 5. व्यूफ्लिपर
- 6. व्यूफ्लिपर
- 7. क्या किसी ने क्रॉसहेयर किया है जो JFreeChart में माउस का पालन करता है?
- 8. एंड्रॉइड व्यूफ्लिपर को लूपिंग से कैसे रोकें?
- 9. एंड्रॉइड - विजेट की तरह कैरोसेल जो बाएं और दाएं तत्वों का एक भाग प्रदर्शित करता है
- 10. सी # JSON.NET सम्मेलन जो रुबी संपत्ति नामकरण सम्मेलनों का पालन करता है?
- 11. एंड्रॉइड: व्यूफ्लिपर या व्यूपेगर - बेहतर विकल्प कौन सा है?
- 12. व्यूफ्लिपर और व्यूस्विचर
- 13. Django: prefetch_related() रिवर्स रिलेशनशिप लुकअप का पालन करता है?
- 14. एक्सएएमएल मार्जिन सीएसएस मानदंड का पालन क्यों नहीं करता है?
- 15. सॉफ्टवेयर संस्करण संख्या का कौन सा नियम पालन करता है?
- 16. वीएस2005, वीएस -2008 किस मानक का पालन करता है?
- 17. सी - क्या निष्पादन को बहु-थ्रेडेड प्रक्रिया में तुरंत कांटे का पालन करना पड़ता है?
- 18. एंड्रॉइड में बैक बटन को संभालने वाला व्यूफ्लिपर कैसा है?
- 19. फ़ाइलस्ट्रीम करता है। तुरंत फ़ाइल बंद करें?
- 20. repaint() तुरंत "पुनः पेंट" नहीं करता है?
- 21. एंड्रॉइड तुरंत ब्लूटूथ डिस्कनेक्ट का पता लगाता है
- 22. क्यूटी QNetworkAccessManager संकेतों को उत्सर्जित नहीं करता
- 23. XPATH: जो तुरंत कुछ विशिष्ट नोड्स
- 24. व्यूफ्लिपर को 'विशाल' देरी
- 25. व्यूफ्लिपर बनाम टुकड़े
- 26. wordpress.com और अन्य समान सेवाएं तुरंत उपडोमेन कैसे बनाती हैं, जो तुरंत उपलब्ध होती है?
- 27. Mercurial में, "एचजी नाम बदलें" काम करता है लेकिन इतिहास फ़ाइल का पालन नहीं करता है?
- 28. एकाधिक वेब व्यू के साथ एंड्रॉइड व्यूफ्लिपर उदाहरण की तलाश
- 29. क्या ग्राडल एक बिल्ड निर्देशिका संरचना को संभाल सकता है जो डिफ़ॉल्ट सम्मेलनों का पालन नहीं करता है?
- 30. व्यूफ्लिपर के एंड्रॉइड में पिछले मान को कैसे जांचें