How to draw beyond the emulator screen in android - android

can any one there help me to draw a rectangle on the Image View which is set as background of image whose size is bigger than emulator size(So it has horizontal and vertical scroll bar)..
I want to draw rectangle at right most corner of the image..so that drawn rectangle is shown only when the image is scrolled to that position..
Please suggest me with code also..
Thank You in advance..

take a large image and insert it in src. and make imageview inside scrollview.

Related

How to put the right border of a View onto horizontal center?

In my Android app, I am using a RelativeLayout to custom one of my Activitys.
I have a square ImageView that I want to set precisely. In other words, I want its right border to touch the horizontal center of the layout.
Is such a thing possible without doing weird things such as centering and then marging?
It's not a perfect solution but potentially you could use:
android:layout_marginRight="xdp"
Where x is half of your screen width + half the width of your imageView?
I know it's not perfect but might help until some guru comes along

image animation cropped by layout bounds

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.

Android - Curve on Top Left Corner in Image

I have a 4 sharp cornered image to display it my android application. But i want that image to be little curved from Top Left Corner. There should be no animation, nothing. Just an Image with a Curve on its top left corner.
Please look into the following image for reference, for what i wanted to achieved.
take a linear layout with fill parent and set background color while. then use image with in linear layout to show another one image on the screen.

It is possible to use ScaleType CENTER_CROP but without centering the image vertically? (showing the top of the image)

I'm displaying a imageview with a bitmap. The imageview initially shows some blank spaces in left and right of the bitmap, so i used CENTER_CROP to solve that. The problem is that now the bitmap is centered vertically and the top of the image can't be visible, and i dont want that. I want that the image top must be displayed, i don't care about the bottom.
It is possible to achieve that?
Have you tried setting the paddingTop to image.I hope by setting paddingTop to the image view you can push the top of the content downward. Sometimes at bottom it will miss something but still you will be able to see the top of the image.

Custom button sizes in pixels

At last i finished my work and now i need to hand it to designer. App has some buttons and checkboxes.
So the question how big button and checkbox should she draw for each screen size(ldpi,mdpi,hdpi,xhdpi) or she could draw just one image for button and anotherone for checbox and it could be scaled?
Thank you already.
It really depends on how big your buttons are. U can check the following link for sizes:
http://developer.android.com/images/screens_support/screens-densities.png
But I agree with Mikelsreal (create a 9 patch image).
Create the button image in whatever size u like.
Add black pixels above the image to set where the image should be stretch horizontal.
Add black pixels on the left side of the image to set where the image should be stretch vertical.
Add black pixels on the right side where the content can be placed vertical
Add black pixels below the image to set where the content can be placen horizontal
rename the image like : yourImageName.9.png
and it should work.
for more info check (developer.android.com/tools/help/draw9patch.html)

Categories

Resources