q42 / androidscrollingimageview Goto Github PK
View Code? Open in Web Editor NEWAn Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.
License: MIT License
An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.
License: MIT License
I put an image with large dimensions in the AndroidScrollingImageView,and i want the height to match the container, but it enlarges and takes the image original size. How to fix this?
Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.util.TypedValue.type' on a null object reference
at com.q42.android.scrollingimageview.ScrollingImageView.<init>(ScrollingImageView.java:83)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
at androidx.databinding.ViewDataBinding.inflateInternal(ViewDataBinding.java:1409)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 29160012 byte allocation with 4194304 free bytes and 24MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:620)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:455)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:478)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:508)
at com.q42.android.scrollingimageview.ScrollingImageView.<init>(ScrollingImageView.java:82)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
at androidx.databinding.ViewDataBinding.inflateInternal(ViewDataBinding.java:1409)
at com.fwd.codigo.databinding.FragmentStartBinding.inflate(FragmentStartBinding.java:109)
at com.fwd.codigo.databinding.FragmentStartBinding.inflate(FragmentStartBinding.java:95)
at com.fwd.codigo.feature.onboarding.StartFragment.onCreateView(StartFragment.kt:70)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2950)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:515)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2177)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2088)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1990)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
2022-07-21 12:16:19.716 13336-13402/com.fwd.codigo.dev E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2022-07-21 12:16:19.717 13336-13402/com.fwd.codigo.dev E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
if you were to set the scrolling offset yourself instead of setting a speed variable, how would you do it?
ive added the implementation 'com.github.Q42:AndroidScrollingImageView:1.3.2' line in dependencies in build.gradle ( Module: app ). im getting this error
It would be much nicer to be able to adjust this custom view's height to its parent, right now with match_parent your image will just be bigger than your parent component.
An ImageView already has scaleType to solve this issue.
So maybe you could inherit your component from ImageView or build something alike?
HI , thank you for your beautiful work.
I am wondering if it is possible to stretch the image to full screen, i have tried to set the width and height to match parent but it stays the same and doesn't stretch. it does stretch in width but not in height :/
what should it do?
The library crashes when integrated along with SubsamplingScaleImageView Library. The gradle sync return the error. How do i solve it ?
Error:(364) Attribute "src" has already been defined
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library [com.github.Q42:AndroidScrollingImageView:1.1] /home/om/AndroidStudioProjects/GoRide/app/build/intermediates/exploded-aar/com.github.Q42/AndroidScrollingImageView/1.1/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.q42.android.scrollingimageview" to force usage
I'm using android studio 3.1.2, my app gradle is given below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.ajay.pocketassistance"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
implementation 'com.andkulikov:transitionseverywhere:1.7.4'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
implementation 'com.github.Q42:AndroidScrollingImageView:1.3.2'
}
Is it a bug?
I love this lib.
but one issue what I marked that.
When I change activity it little bit stuck scrolling and after then activity change.
Hi,
I was providing buttons to scroll image left or right. On click I set the speed and started the scrolling in selected direction for certain amount of time(used thread for this). Then when i scroll the image to other direction then it starts scrolling from image's start, actually it should scroll to other direction from the current position shown on UI.
hi, how set the image programmatically in java?
thanks
How do I specify the sequence of images?
11-16 13:26:05.080: E/AndroidRuntime(3447): java.lang.RuntimeException: Unable to start activity ComponentInfo{scrollingimageview.android.q42.com.sampleapp/scrollingimageview.android.q42.com.sampleapp.MainActivity}: android.view.InflateException: Binary XML file line #28: Error inflating class scrollingimageview.android.q42.com.sampleapp.ScrollingImageView
Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.util.TypedValue.type' on a null object reference
at com.q42.android.scrollingimageview.ScrollingImageView.(ScrollingImageView.java:57)
I am trying to place ScrollingImageView inside HorizontalScrollView, but it shows "Error inflating class HorizontalScrollView".
How do I specify the sequence of images?
If one ,It prompts “Bitmap too large to be uploaded into a texture (7333x479, max=4096x4096)” , So I cut a picture into pieces so that can show it .
Bitmap too large to be uploaded into a texture
under project model (build.gradle)
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
under app model (build.gradle)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.Q42:AndroidScrollingImageView:1.3.3'
}
Step 1. Add the JitPack repository to your build file
repositories {
// ...
maven { url "https://jitpack.io" }
}
Step 2. Add the dependency in the form
dependencies {
compile 'com.github.Q42:AndroidScrollingImageView:1.0'
}
I can not understand how to use
Where is the license file?
while (offset <= -getBitmap(arrayIndex).getHeight()) {
offset += getBitmap(arrayIndex).getHeight();
arrayIndex = (arrayIndex + 1) % scene.length;
}
float start = offset;
for (int i = 0; start < clipBounds.height(); i++) {
Bitmap bitmap = getBitmap((arrayIndex + i) % scene.length);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
canvas.drawBitmap(bitmap, getBitmapLeft(width, start), getBitmapTop(height, start), null);
start += width;
}
if (isStarted && speed != 0) {
offset -= abs(speed);
postInvalidateOnAnimation();
}
While editing my layout in Android Studio 2.2 Build #AI-145.3276617 I get this error right after including ScrollingImageView
The following classes could not be instantiated
java.lang.NullPointerException
at com.q42.android.scrollingimageview.ScrollingImageView.<init>(ScrollingImageView.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$72(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
As of now I'm trying to debug the problem by myself but it seems I can't get a solution. But if I get one I'll post here
Error:(20, 13) Failed to resolve: com.github.Q42:AndroidScrollingImageView:1.1
It says this, what is wrong?
I put it in the app build.gradle not in the top-level build gradle. Is this the bug?
It should not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.