How to display fullscreen image from viewpager as small image in gridview? - java

I followed this link http://www.androidbegin.com/tutorial/android-implementing-viewpager-into-gridview-tutorial/ to obtain gridview in viewpager. But my problem is that the image displayed as full screen in viewpager appear to be cut in gridview window. I want the image that appear as full screen should also appear in gridview window. In other words, the image displayed as full screen should appear as whole in small size image in gridview window.I meant something like the images displayed in this question link...Order of images in Grid View in Android
I just start with programming, so please give some explanations, or it will be great if you also give some codes :)

I suggest you have a look at ImageView.ScaleType. It it will show you how the image should be scaled, cropped, etc. to be displayed in an ImageView.

Related

How to remove white background from dialog box with custom image background?

i wanted to create a custom dialog like the first image for a Android game.after a lot of trial and error i was able to create a dialog box that's looks like the 2nd screenshot image.
even though it looks identical to what i wanted to achieve,but it shows white pixels around the image even though it is a png.
How can i remove the white pixels from the screenshot dialog box image and make it look identical to the first image?
Add this code to ur dialog box to make it transparent
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
or
dialog.getWindow().setBackgroundDrawable(new ColorDrawableResource(R.color.transparent));

Any way to display wallpaper in app?

My app consists of five different fragments where the user can slide from one to another.
I have applied the stack (Official Google Animation) to the fragments so the layout looks more appealing when transitioning from one page to another. I went ahead and made some changes, but when swiping you an see a black background so I had changed the default background in my styles.xml to a pre-fixed image. But I wish to apply the wallpaper of the system. For example I'm on my home-screen and I have lets say a picture of a cat as my wallpaper, and when I open my app, and scroll across screens I want the background to display the system wallpaper, aka the cat picture.
How can I go about achieving this?
I have searched on this but nothing is showing up, I've tried adding a colour item to colors.xml and setting the hex value to #00000000 and applying this to the background, but when sliding across the fragments, there is no transparency, instead it's black.
It seems so I can use this code -
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
Drawable wallpaperDrawable = wallpaperManager.getDrawable();
But how can I apply this as a background to all of my fragments? I'm aware that it must be applied in the fragmentlauncher class where all my fragments are launched from.

Fill screen with ImageView on tap

I have a ListView in my application that has both text and images in it on each row. Now, when the row is clicked I'd like to zoom the image to fill the screen. On the next click it should collapse to it's original size.
What I'm looking for is something similar to Lightbox. When the image is clicked it expands.
I have access to the ImageView. What do I need to do to it to achieve this kind of effect?
If you want to zoom in/out view you can use scale animation. I recommend to watch Chet Haase tutorials called DevBytes: View Animations

Adding a slide view to images

I am trying to get images from Internet. (i can't show my code here). i AM storing a few images in a list and displaying them in an imageview each image after tapping other.
However, I want to make a slide of these images.
It's just a basic 'move to next picture' by sliding your finger on the screen.
Same as it would be in the phone photo gallery.
It's just to navigate through the images.
At the moment the image is going to the next one by the user tapping on the screen. But in this manner we can't go to the previous image. This is why we need to change the navigation to sliding a finger on the screen.
I have used View Flipper and ViewPager but how am i suppose to add images to these views after getting from internet each time.
Best Regards
here from below link you can download the example it can help you
https://github.com/nostra13/Android-Universal-Image-Loader

Getting graphical buttons to line up in xml

I have a custom popup window with a custom image background in which I need to place three custom buttons with their own background images. I have only one set of images for all the components, so I want all the parts to scale appropriately. My question now is how do I make sure that the buttons line up with the appropriate parts of the background image of the popup window. I have been experimenting with all sorts of widths and heights and I can not make it look consistent on all my test devices. Can anyone give me some pointers?
EDIT: Just to make it as clear as possible, the image below illustrates the kind of thing I am talking about:
I want the graphical button to line up with the arrows which are a part of the popup window background image.
arrange buttons in an xml layout and set this view to your custom popup and you can set images to buttons from code.

Categories