I have a RelativeLayout and I want to save its content to Bitmap. There are tonns of solutions here but no one suits for my task.
The main difficult is that view has, lets say, 700x900 px size. I want to get a screenshot of that view as the size would be 1000x1000. I cannot just make a screenshot with getDrawingCache() and scale it because views inside RelativeLayout will be shrinked/stretched.
I think that I need to resize view itself, make a Bitmap from it, and resize it back. But! If I resize a view it will be bigger than screen and getDrawingCache() works only for visible part of the view. I cannot put my into ScrollView to workaround such behaviour.
Any help is appreciated.
Related
Is there a way to dynamically set the ViewPager to wrap the child image just nice without leaving any space in between the height of the view pager and the top and bottom of the image?
I tried using the solution of https://gist.github.com/egslava/589b82a6add9c816a007
But the solution in the link only wraps all the images according to the height of the highest child view. Which makes every other smaller lower images look even flatter.
Is there a way to wrap the images according to each height of the child images? I don't mind the width being cropped off, I'm just more worried about the height. Some of my images fits perfectly without any loose spaces but there are a few which seems too flat in the view pager.
Hope to see your answers soon. Thanks for reading.
If it's white space you want to avoid why not try setting background to transparent.
enter image description hereI have a custom view and the user can draw rectangles(I used canvas). I would make the size of custom view bigger than the size of the screen. So, the user can draw not only in the size of screen. I tried ScrollView and NestedScrollView but they are not helpful to solve my problem.
As far as I could understand from this question is you want to make a canvas where someone can draw some pictures. So you need a bigger canvas to that user can drag the positions to left-right, up and down. If I understood correctly, then I would say, you might think of a different work-around instead of looking for a view bigger than the screen size.
You can think of an simple ImageView which will be auto zoomed-in and if the user clicks twice it'll zoom-out. The user can drag the positions of the ImageView whenever he wants.
Here's an SO answer about how you can implement the zoom in and out in an ImageView. Hope this will help to solve your problem.
I have an image that gets scaled from large to small as it spins. It's mean to be a fancy animation to simulate a tile being place on a board. The animation works as expected except for one thing: This image is cropped.
Each row of tiles is inside of a Horizontal LinearLayout. Each LinearLayout is inside of another LinearLayout (Vertical). This give the board. Sadly, the image animation is getting cropped to not excede the bounds of the parent layout. I don't want that. I want the image to be displayed and animated as if it's on top of everything else. I want it to exceed the layout.
Any idea how to fix this?
Here's a couple of screenshots:
Your image is constrained to fit within it's parent view as per design. You might want to use a canvas to hold all your tiles instead (keep in mind the bounds of the canvas for the corners otherwise you will have the same issue), or look into other layouts that might be able to accommodate your needs.
From: http://developer.android.com/guide/topics/graphics/view-animation.html
Note: Regardless of how your animation may move or resize, the bounds of the View that holds your animation will not automatically adjust to accommodate it. Even so, the animation will still be drawn beyond the bounds of its View and will not be clipped. However, clipping will occur if the animation exceeds the bounds of the parent View.
i have to take something like a screenshot in my android application. It is not a screenshot, it should be a "viewshot". It is about to render the complete content view on a bitmap.
I have found the solution to render the content view of the activity on a bitmap, but if the content view is bigger than the activity, it is only the visible part which gets drawn onto the bitmap.
Does anybody have a solution for this, or some ideas what to google?
Thanks
The content view is never "bigger than the activity", by definition.
The content view may be scrollable, but most scrollable things are either AdapterViews or use a tile mechanism (e.g., MapView), none of which are rendered until they are scrolled into a visible position. There is no stock way to make a "viewshot" of things that have not been rendered. You are welcome to create your own AdapterViewShotter that iterates over the items in the Adapter, captures each to a Canvas, and stitches the lot together into a huge image.
I have a custom view that is scaling to 200% when the user clicks on it.
Now I want to prevent some controls/views in that custom view from beeing scaled.
Is there some way to do this?
After further investigating I think there is no way to programmatically freeze a view as described. As a dirty workaround you can put the view that should not be scaled in another container that is positioned over the scaled view.