Comments (7)
Probably because the view is being invalidated every time.
You can profile the code and see if there is a possiblity to cache the bitmap.
Is there a sample I can run ?
I don't think automatically caching and breaking the invalidate function would be a good idea.
I suggest you look at bitmap shaders.
Does this answer your question ?
from android_maskable_layout.
This is a library that you can try here https://github.com/Q42/AndroidScrollingImageView
<com.q42.android.scrollingimageview.ScrollingImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_gravity="bottom"
scrolling_image_view:speed="0.25dp"
scrolling_image_view:src="@drawable/world_map" />
and put it in your MaskableFrameLayout.
from android_maskable_layout.
Well, thats normal. The view is invalidated each time, causing it to mask every time.
Every time it scrolls it invalidates, the mask is being applied.
So this will be very slow.
Either decrease the amount of invalidates or use bitmap shaders.
from android_maskable_layout.
I also use other views like Frame layout inside MaskableFrameLayout and i animate the views inside frame layout and animations are slow there too. The reason that i use this great library is that it makes it available to mask any view!
is there a workaround that it perform better in animations?
I am not familiar with shaders, how can i use an implementation?
from android_maskable_layout.
Your animation will invalidate each time, causing a masking operation to be executed every time.
Optimize your animation or profile your code.
from android_maskable_layout.
I appreciate, If you can help me. I have two different views with different animations inside two maskable layout. In first one, i need to simulate a world map sphere movement in a loop so i used this lib(https://github.com/Q42/AndroidScrollingImageView):
<com.q42.android.scrollingimageview.ScrollingImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_gravity="bottom"
scrolling_image_view:speed="0.25dp"
scrolling_image_view:src="@drawable/world_map" />
in second one i just have move and scale animations but i use this (https://github.com/daimajia/AndroidViewAnimations) library for implemented animations
private void animateLines() {
new Handler().postDelayed(() -> hideLineViews(false), 20);
YoYo.with(Techniques.SlideInRight)
.duration(lineAnimationDuration)
.interpolate(new LinearInterpolator())
.playOn(lines[1]);
YoYo.with(Techniques.SlideInUp)
.duration(lineAnimationDuration)
.interpolate(new LinearInterpolator())
.playOn(lines[0]);
}
private void animateExtensions() {
new Handler().postDelayed(() -> hideExtensionViews(false), 40);
for (View v : extensions) {
YoYo.with(Techniques.ZoomIn)
.duration(lineAnimationDuration)
.interpolate(new LinearInterpolator())
.playOn(v);
}
}
What is your suggestion?
from android_maskable_layout.
Use bitmap shaders.
You are masking the view each time is animates.
That is really cpu intensive.
Maybe try using the hardware layer, but I doubt that will work.
I recommend looking into bitmap shaders.
from android_maskable_layout.
Related Issues (20)
- Out of memory issue HOT 2
- Repo not found or no access token provided HOT 4
- General code improvements HOT 1
- Mask works on Android emulator only
- Problem with implementation HOT 2
- Set PorterDuffXferMode programmatically HOT 1
- support for Vector Drawable HOT 3
- Elevation shadow missing HOT 2
- MaskableFrameLayout.dispatchDraw java.lang.RuntimeException: HOT 3
- Use B&W Mask HOT 4
- Masking GLSurfaceView HOT 1
- Missing break HOT 4
- Out of memory on a 9193040-byte allocation. HOT 1
- Setting the mask programmatically seems to not work HOT 7
- Fix rate for mask? HOT 1
- Cropping map fragment removes more than needed HOT 3
- Flickering with animation of Constraint Set HOT 1
- Masking disappears HOT 1
- Transparent Issue
- how to disable with code?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android_maskable_layout.