I have have a seekbar in inside a Liner Layout. This liner layout background image is set dynamically (Image coming from SDCARD). Thumb image is within the application. Progress drawable is transparent color.
There are image view around 6-7 all shows image from the SDCARD (images assigned in onCreate()). Depending upon the seek bar progress we showing particular image view. Seek bar max value is set dynamically (Depending upon imageview i.e.100 * no of imageview).
The problem is seek bar start lagging Just seekbar lagging (thumb movement) for last image view i.e. if max is 800 it lag from 700 to 800.
I am not able to figure out actual reason for lagging. Does any one faced same problem. What will be possible solution or fix to slider?
Thank You
Related
I have an ImageView in a ViewPager2, the ViewPager2 uses a ConstraintLayout to organize all its elements into place. It takes a sec for the image to load in causing for the ViewPager2 height to fluctuate. I can use a transparent placeholder image that is statically sized but depending on the screen size I want this image to adjust to fit the screen appropriately so again I run into the height fluctuating.
I've tried to use a LinearLayout and RelativeLayout, but the tradeoff of these is that they don't handle the other dynamic content that loads right away neatly.
Any recommendations for how to solve this issue is appreciated. My guess is that if I can know when the image is loaded in or when it is ready to be loaded in via URL then I could pause on displaying information in the ViewPager2 until all the information is ready.
I also use a progress bar that is not attached to the image being loaded so the progress bar is always displayed. Knowing if the image has loaded in will allow me to set the progress bar's visibility to GONE programmatically, but this isn't too much of a problem since it is covered by the image anyways.
I would like to create a background which contains large (very wide) image which keeps on scrolling in an infinite loop.
So basically, each time, only a rectangle of the image (cropped) is shown and that rectangle keeps on scrolling smoothly on top of the image in turn showing a different part of the image.
How do I do that?
You can set the .gif image file in the background:
Is it possible to set an animated gif file as background of my app in android?
OR
You can implement Parallax by yourself
I'm trying to create a layout with multiple buttons, But all buttons was not displayed on Screen, So i used scroll view but now i have one problem because of background image (which is of high resolution). Now i'm getting very large empty space under after buttons. Please suggest a solution how can i fix scrollView hight so that it doesn't show the space under buttons.
like This :Area with white background is Moblie visible screen and off white area is background image.
The best solution would be to use an appropriately sized image. If you only want to display part of the image, but the image is a high resolution image, then you are wasting resources by loading the entire image.
You could enclose the ScrollView within another View, and set the background of your parent view to be whatever background you desire. Set the height of both views correctly and you should achieve your desired result.
The hierarchy would be
View (with background image)
ScrollView with buttons
I am developing a game where i have to drag and drop images on specified pattern.So that if the pattern matches the dragged image with the dropped specified image then it gets pasted at that pattern.I have developed the code for the drag and drop and has a a logic to achieve further but stuck up in very small logic i.e. **If i provide layout-width and height as "match-parent" of image view then i can drag it through out the screen but as i have sequence of 4 images placed horizontally then i am forced to give wrap-content but then when i drag the image outside it specified limits it gets hidden and hence only visible within its dimension ** I know its showing the characteristics which it suppose to but i am stuck both ways.Please help me out.
When Activity is created:-
When i try to move or drag the image it starts getting hidden:-
I have set negative paddings on my custom seekbar so that the round thumb image can go outside the bar, but the thumb isn't rendered out there, is there anyway to force the thumb to be drawn outside those bounds?
Sorry guys, I'm new to Android development, and have been tasked with fixing an existing application. The problem is that we have a custom rounded looking track bar, which consists of two rounded 'end cap' images and a 1 px background that is tiled to create the seekbar. As far as I can tell there was never one image that could be set as the background of a normal SeekBar, which is why a custom one was created.
The thumb is a circle and needs to 'fit' into the end caps - the three pieces of the bar are in a relative layout. Right now I'm kind of unclear as to how the 1 px background png gets stretched as the seekbar bg, otherwise I would try to tack on the two endcaps onto that drawable some how ... ?
Please let me know if this was unclear and I'll try to post any followup info. Thanks in advance for any advice!!
Oh, I'm using Android 2.1 if that's relevant to anyone's interests :)
This is what it looks like when the thumb all the way over - outside of the seekbar. Ideally what I need is for the thumb to be shown as 'inside' the endcap image :-/
I was having the same problem, my thumb is very big length wise and it kept being cut off. Make sure that you set the offset property AFTER you set the drawable for your thumb, like this:
seek.setThumb(Main.app.getResources().getDrawable(R.drawable.thumb));
seek.setThumbOffset(15);
This will set the correct offset when your thumb is very long.
Try to change the thumb offset property, after that it will not go off from the seek bar
I just ran into this issue. I was able to get satisfactory results by using android:paddingLeft and android:paddingRight within the XML.