मान लीजिए आप एक ImageView
नामित imageView
और एक एनीमेशन फ़ाइल your_fade_in_anim.xml
अपने रेस के अंदर है \ anim \ फ़ोल्डर:
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.your_fade_in_anim);
// Now Set your animation
imageView.startAnimation(fadeInAnimation);
आपका एक्सएमएल
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="[duration (in milliseconds)]"
android:repeatCount="infinite" />
</set>
कोष्ठक बदलें आपकी वास्तविक अवधि के साथ।
स्रोत
2011-02-23 11:49:40
धन्यवाद एक बहुत, आदमी! समस्या यह है कि यदि दृश्य अदृश्य है तो एप्लिकेशन निष्पादित नहीं किया जाता है, इसलिए ऑनस्टार्टएनीमेशन विधि का उपयोग नहीं किया जा सका। लेकिन मैंने एनीमेशन शुरू करने से पहले, बटन के श्रोता में दिखाई देने वाला दृश्य सेट किया है, और मैं ऑनएंडएनीमेशन में दृश्य को अदृश्य होने के लिए सेट कर रहा हूं। – Gratzi
मुझे समझ नहीं आता क्यों तुम onEndAnimation में अदृश्य करने के लिए एनीमेशन निर्धारित करते हैं, अपने प्रारंभिक सवाल में आप कहते हैं कि आप इसे में फीका करना चाहते हैं कि और दिखाई देने लगते हैं, तुम क्यों onEndAnimation में अदृश्य करने के लिए सेट? – Ixx