I'm using Lottie animation but the animation area(height) only reach half of screen even my LottieAnimationView use 0dp to match parent. I'm not sure is this an animate JSON issue, in JSON width is 768 & height is 1500 and I use pixel 6 which is dp 412 x 915 to test. What I want is coins are able to drop full screen, so I tried use scale y but I found the coin shape will transform, plz help, thx.
Lottie version : com.airbnb.android:lottie:5.2.0
The animation file I use the link :
https://lottiefiles.com/134069-coin-rain
The configs for LottieAnimationView
The animation looks like below, the coins only drop half height of my screen.
I have created demo using your code and yes it is because of json file other wise your code is perfect ..
so you just need to change json file
you can use this json file as mentioned below
https://lottiefiles.com/117802-coin-drop
i have tried to create demo using above json file and it is working fine but it is too fast by default so you need to manage speed as per your requirement .
You can control speed using app:lottie_speed="0.5"
i hope it will help you
Related
I want your help regarding a problem.
I am creating an app, and I have like 9 images which I want to appear horizontally across the screen.
Check this image
But in the above screenshot, as you can see, I have only 8 images and the screen seems to be full, I want to add one more image of number 9.
Here is my activity_main.xml (hastebin link)
It will be more helpful if you could explain to me a bit rather than just fixing it, also, could you please suggest other fixes, this is the college project I am working on.
Thank you for your precious time :)
If the images are fixed, you can set your LinearLayout width (the ones that contains the images) as "match_parent" and add the attribute weightSum = 9 . That will make its width the same as the container. Then you set each image width to 0 and add weight= 1.
This will make each image width 1/9 of the parent, no matter the size of the device screen.
It will look something like the answer of user9209780.
I have used GraphView 3.0 library for my ECG analysis project on Android. I cant find any option to customize grids ratio or you can say step size for x and y axis.
If I need to edit the source code then also let me know how am I supposed to edit it and which function can be edited for this purpose?
Do you mean the number of horizontal and vertical labels?
You can set them by using these getGridLabelRenderer methods:
graph.getGridLabelRenderer().setNumHorizontalLabels(int numHorizontalLabels);
graph.getGridLabelRenderer().setNumVerticalLabels(int numVerticalLabels);
I have read all about supporting different screens and I understand the concept of Density Pixels (DP). However one thing I am not sure about. Lets say I have an image file which is 200 by 200 pixels and I loaded it using xml with wrap_content attributes at the top left of the screen (0,0). Now let's say I want to place a textview programmatically beside it.
If I put the text view at coordinates (250,0). Does that mean that the text view will never overlap the image and will always be to the right no matter what the device density/screen size is.
I understand the distance ( gap) will be different but I am hoping my theory of not overlapping will hold.
I tried it on 2 device and no issues but I am not sure if this is coincendence
Thanks
If you are using px unit it will always remain the same. But if you are using dp unit instead of pixel you cannot definitely be sure.
By the way you should use toRightOf property instead of this approach if you only want this.
I would like to know whether there is such possibility to customize the screen size on Android devices? Something like using half part of the screen and the other half is blank.
For this kind of problems, you can work with percentage. There are 2 common ways:
in java:
You can get the display height from your used lcd-panel and then multiply with your number of percents. In this way, you have to format the button in your activity.
in layout xml:
You should design your layout within the xml-files and not in java code (my oppinion). Use layout-weight like following post: set position size of ui element as percentage of screen size
iam stuck with the creation of a nine patch for a progressbar background.
It has a repeating pattern like a ruler-scala and that given me headache.
here is a image of what i want(at the bottom) and what i have (top).
can someone give me a hint how to acomplish my goal?
edit: or is it generelly possible to do this with a 9patch?
my other attempt was to make a with android:tileMode="repeat" but there i get problems with the height of my image (repeating in the second line), i need something like repeat-x.
Thanks in advance
edit2: ok i managed to do my repeating 9patch by stretching the whole repeating pattern, but its not ideal :(
You seem to be overestimating the power of 9-patches. The most you could do is have a ruler image with expanding space between the ticks. You can't, however, make a 9-patch that automatically tiles parts of your image.
On the other hand, if you create a BitmapDrawable programatically, you can set the tile mode separately for the X and Y axes.
I used to do this in my webview project using border image which provides both options (repeat, stretch, fill).
As webview has kind of it's own problems in android (mostly fixed element) I decided to be more android for the next project and I found out that it's not possible to have the repeated border using 9Patch. It's so awkward as it's needy but not implemented.
In a word android development area makes me crazy, one option here one option there is a usual thing here.