2009-07-31 19 views
5

क्या कोई तरीका है कि मैं एक सूचीदृश्य पर प्रोग्रामिंग रूप से फ़्लिंग कर सकता हूं? मुझे पता है कि बंदर है जो इन सभी चीजों को करता है लेकिन इसके लिए एडीबी आदि के साथ कंप्यूटर कनेक्शन की आवश्यकता होती है। मैं बिना किसी बंदर के किसी भी फोन पर अपने ऐप के साथ ऐसा करना चाहता हूं।प्रोग्रामेटिक रूप से फ़्लिंग सूची देखें एंड्रॉइड

धन्यवाद, फैसल

उत्तर

-1

आप इसे एक anim के साथ नकली (मुझे लगता है कि accelerate_decelerate_interpolator काम कर सकते हैं) कर सकते हैं।

भी ऐसा लगता है अपने खुद के द्वारा अपने दृष्टिकोण को स्क्रॉल के लिए समर्थन है:

public void scrollBy (int x, int y) 

आपके विचार का स्क्रॉल स्थिति में ले जाएँ। इससे स्क्रॉल चेंज (int, int, int, int) पर कॉल होगा और दृश्य को अमान्य कर दिया जाएगा।

Parameters 
x the amount of pixels to scroll by horizontally 
y the amount of pixels to scroll by vertically 
public void scrollTo (int x, int y) 

आपके विचार का स्क्रॉल स्थिति निर्धारित करें। इससे स्क्रॉल चेंज (int, int, int, int) पर कॉल होगा और दृश्य को अमान्य कर दिया जाएगा।

 
Parameters 
x the x position to scroll to 
y the y position to scroll to 
+0

हे लुकास, क्या आपके पास कोड स्निपेट है, मैं बहुत उलझन में हूं। धन्यवाद, फैसल –

+1

हैलो, मैंने और जानकारी जोड़ी आपकी मदद करेगी। –

+0

धन्यवाद आदमी मुझे यह नहीं पता था! –

2

किसी स्थिति पर कूदने के बजाय "चिकनी स्क्रॉल" के दो तरीके हैं।

बाहर http://developer.android.com/reference/android/widget/ScrollView.html

smoothScrollBy() और smoothScrollTo() की जांच करें।

उम्मीद है कि इससे मदद मिलती है।

+0

आप स्क्रॉलव्यू का जिक्र कर रहे हैं और प्रश्न सूचीदृश्य के लिए था। लिस्टव्यू में कुछ साफ विशेषताएं भी हैं: smootScrollToPosition और smootScrollByOffset। हालांकि ये केवल क्रमशः एपीआई स्तर 8 और 11 में उपलब्ध हैं। http://developer.android.com/reference/android/widget/ListView.html#smoothScrollToPosition(int) –

1
private AnimationSet set; 

public void onClick(View v) { 
    if(v.getId() == R.id.pullbutton){ 
     artListview.setVisibility(View.INVISIBLE); 
     if(set == null){ 
      set = new AnimationSet(true); 
      Animation animation = new AlphaAnimation(0.0f, 1.0f); 
      animation.setDuration(100); 
      set.addAnimation(animation); 

      animation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, 0.0f, 
        Animation.RELATIVE_TO_SELF, 0.0f,    
        Animation.RELATIVE_TO_SELF, -1.0f, 
        Animation.RELATIVE_TO_SELF, 0.0f 
      ); 
      animation.setDuration(1000); 
      set.addAnimation(animation); 
     } 
     showPullDownSectionList(); 
    } 

} 


public void showPullDownSectionList() { 
    flipper = (ViewFlipper) findViewById(R.id.ViewFlipper01); 
    flipper.setVisibility(View.VISIBLE); 
    setLayoutAnim_slidedownfromtop(flipper); 
} 

public void setLayoutAnim_slidedownfromtop(ViewFlipper flipper) { 
    LayoutAnimationController controller = 
     new LayoutAnimationController(set, 0.25f); 
    flipper.setLayoutAnimation(controller); 

} 
संबंधित मुद्दे