I need to make a slider index like this:
(In this case it's indicating that the current index is 3).
Since it doesn't seem to be a finished solution, I have to make a custom one.
2 Possibilites come to my mind:
Create a custom component and draw/update the circles using onDraw. Only "geometric" drawing. But it has limitation in effects. Maybe I want a shiny circle or something, then that will not work. On the other size resize is easy.
Use bitmaps. But I don't know if this is maybe expensive... (If I have 30 or more). And from some count I have to scale down, and this could not look good anymore.
Or maybe something else?
Can anyone advice me what's the way to go to do this...
Thanks.
Related
I've been fiddling around with RenderBlur on an image for my login screen, i've gotten everything to work with a runnable() and a delay to blur the image immediately, however i'm trying to make it a slow blur while the username and password fields come into view.
I've had a bit of a look around (could be looking in the wrong places) but I haven't found anything related to what i'm after. I've attempted to use a while loop and have a blurradius value increment with a delay afterwards and send to the blurBitmap class method, but it either still blurs it immediately (meaning I probably messed something up somewhere and will most likely keep trying with this method until a better solution is found).. or it crashes.
Does anyone know if, in the first place this is possible with RenderScript? And if so, what should I be searching for.
Thanks for any help you can provide.
Resources: https://futurestud.io/blog/how-to-use-the-renderscript-support-library-with-gradle-based-android-projects
You can do this with RenderScript, though how you are doing it now doesn't sound like a good idea. Look into using a custom Animator which you can then run a RS blur against the image. Using Animator will be more flexible in the long run and automatically ties in with the view system rather than requiring you to handle View or Activity state explicitly.
The approach #JasonWihardja outlined will also work, but again I would suggest doing this in an Animator or similar mechanism.
Blurring an image repeatedly might cause some performance issues with your app.
Here's what you could do:
Arrange 2 images (1 for the clear image and the other for the
maximum blur version) so that the blur image is placed exactly on
top of the clear image. The easiest way would be placing 2 ImageViews in a FrameLayout
To achieve the "slow" blur effect, initially set the blur image's alpha to 0.
Then, using one of the view, issue a postDelayed event to slowly increase the blur image's alpha to 255.
In this mock up, see the screen where it said "Decrease Traffic", the traffic light pops up from below.
https://dribbble.com/shots/2106573-Intro-App-Interaction
I'm wondering how to create that effect on Android, if possible, any library to do that. Thanks
you can achieve this with Android Property Animations
in your example it seems to be a scale animation from 0 to 1 in x and y direction.
you can also combine different animations to get such or other effects.
My guess is that these kind of animation are to develop with a 3rd party program, and are not done by Android itself.
This way you have a ready-to-instantiate file (.gif maybe?) that you just call when the view pager is switched.
Looking also to the other animations in the example (look # "Meet New Friends", how every circle pops by himself) I think this was the used approach in your example-link.
If you are anyway looking for something that would look like what is done there, I'd suggest you start playing around Animator objects (and its subclasses like Value/ObjectAnimator) to animate the view you want.
This can be done also via XML files, describing the animation you need.
An important role in this do-it-yourself animation is played by Interpolators , who give you the chance to further customize the animation in an easier way (take a look at OvershootInterpolator, which lets your animation go a bit after the destination value you set, just to turn back later, giving you a "blob" effect. This might give a better idea what I'm meaning)
I need to draw a tournament bracket in Android. I already calculated the positions for all games (i.e. an (x,y) tuple that defines where to place teams in a spreadsheet-like structure). However, I don't know the preferred way of drawing the bracket. I found an example that shows what I need:Example
My first idea was to programmatically create and fill a TableLayout. However, borders are not really supported and a lot of TextViews are needed to fill the space between games. So I am not sure if this is the best way to do it.
Does anyone have better suggestions or maybe even an example of something similar?
I'd suggest custom drawing using Canvas. That way you can draw wherever it makes sense and probably even support zooming without too much work.
Basically, I am making a rectangle that represents charge on your weapon. I want a green rectangle to advance over a red one after a certain amount of time. My issue is the timing. I have no clue how to do any timing anything in android.I'm fairly new so don't use too many things I might not understand. All of this is within a view. I researched threading and handlers, but just got confused.
Check out View Animations if you want to support pre 3.0 without using a library. OR Property Animations if targetting 3.0+ is ok.
I have more experience with the View Animations and I can tell you that the Scale animation is the one you'd be looking for. Make your X scale to 100% its size perhaps would get the job done.
I'm working on a game that in some ways is similar to Tetris (imagine a 2D array of colored squares that sometimes move around)
I am trying to animate the individual squares so they will smoothly slide down from coordinate to the next. Since I wanted to use Android's built-in tweening feature, the animation has to apply to the whole View (rather than parts of it). This doesn't work well for me because I only want some of the colored squares to slide down, and the rest of them to stay still.
The (theoretical) solution I came up with to resolve this is to make 2 Views, layered directly on top of each other. The top view is for animating squares when they need to move, and the bottom layer is for the static squares. The animation-layer is transparent until I am ready to animate something. I then simply turn on the colored square in the animation-layer, tween it to the new location, and turn it back off when done. In the same time span, the static-layer just turns squares on and off at the right time to make the whole thing look seamless to the end user.
The proposed solution is just a theory, since I haven't been able to make it work correctly yet. Since I have been having trouble, I was wondering if this is even the best way to solve the problem? Perhaps there is a more elegant solution that I am over looking? Anyone know of a better way?
If you just want to animate a single element check out the namespace android.view.animation.Animation. You can also use Drawable shapes and draw them directly. Finally, if you want a simulation then you will have to look into threading. Basically you will create a timer to update the canvas for you based on an interval. There are some other view canvases you can use as well like the GLView canvas.