android - How to create a looping animation by continuous translating an image? -


इस तरह एक दोहराई गई छवि का उपयोग कर,

 दोहराई गई छवि

क्या ऐसा एनीमेशन बनाना संभव है?

 एपिसोड लूपिंग

मुझे लगा आउट


MainActivity.java: <पूर्व> सार्वजनिक वर्ग मुख्य गतिविधि गतिविधि को बढ़ाता है {@ ओवरराइड संरक्षित शून्य पर क्रेट (बंडल सहेजे गए इन्स्टैंसस्टेट) {super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); अंतिम पूर्ण स्क्रीन Width = getScreenDimensions (यह) .x; अंतिम अंतराल लहर ImgWidth = getResources ()। getDrawable (R.drawable.wave) .getIntrinsicWidth (); इंट एनिमेटेडव्यूव्यूथ = 0; जबकि (एनिमेटेडव्यूविथ & lt; स्क्रीनविड्थ) {animatedViewWidth + = waveImgWidth; } एनिमेटेड वीव्यूथथ = = लहरआईएमजीड्यूथथ; देखें एनिमेटेडव्यू = ढूंढें VeeById (R.id.animated_view); फ़्रेम लेआउट। लेआउटपैरामीटर लेआउटफार्म = (फ़्रेम लेआउट। लेआउटपारम) एनिमेटेडView.getLayoutParams (); layoutParams.width = animatedViewWidth; animatedView.setLayoutParams (layoutParams); एनीमेशन लहरअनिमेशन = नया अनुवादअनुमति (0, -वेईएमजीविड्थ, 0, 0); WaveAnimation.setInterpolator (नई LinearInterpolator ()); waveAnimation.setRepeatCount (Animation.INFINITE); waveAnimation.setDuration (2500); animatedView.startAnimation (waveAnimation); } सार्वजनिक स्थैतिक प्वाइंट डॉटस्कीडिशन (संदर्भ संदर्भ) {int width = context.getResources ()। getDisplayMetrics ()। widthPixels; int height = context.getResources ()। getDisplayMetrics ()। heightPixels; नया बिंदु (चौड़ाई, ऊंचाई) लौटाएं; }}


activity_main.xml:

  & lt; फ़्रेमलेआउट xmlns: android = "http://schemas.android.com/apk/ res / android "xmlns: tools =" http://schemas.android.com/tools "एंड्रॉइड: layout_width =" match_parent "एंड्रॉइड: layout_height =" match_parent "& gt; & Lt; एंड्रॉयड देखें: आईडी = "@ + आईडी / एनिमेटेड_दृश्य" एंड्रॉइड: layout_width = "match_parent" एंड्रॉइड: layout_height = "74dp" एंड्रॉइड: पृष्ठभूमि = "@ ड्रॉएबल / वेव_रेपीटिंग_बीजी" / & gt; & Lt; / FrameLayout & gt;   


wave_repeating_bg.xml:

  & lt;? Xml संस्करण = "1.0" एन्कोडिंग = "यूटीएफ -8"? & Gt; & Lt; bitmap xmlns: android = "http://schemas.android.com/apk/res/android" एंड्रॉइड: src = "@ ड्रॉएबल / लहर" एंड्रॉइड: tileMode = "repeat" / & gt;   


ड्रॉबल- xxhdpi / wave.jpg:
दर्ज करें छवि विवरण यहाँ

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -