Any way to display wallpaper in app? - java

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.

Related

How to control the width or the visibility of an activity

I'm using this awesome library Dragger to add drag features to my activity, but is there a way to limit the width of the activity when it shows up or dragged..!? I don't want it to fill the entire screen..! kinda like the drawer navigation menu (see the pic below).
I was thinking of Dialog Activity, but it seems to be concerned with dialogs only and won't allow filling the other 3 sides or I not fully understand it..!
Any help?
Activity is not a view, so it does not have a size. Its' layout views do however.
You can try changing their sizes. Or, as it is an animation lib, you can try modifying existing or adding your own animations where views change sizes when moving. You can modify this param:
<item name="android:windowAnimationStyle">#null</item>
This might help you.

Android Design like Google map

I am developing an application in which map is integrated and there are multi markers on it...
As you seen in the picture I want to design my application like this...
Means in first the map markers are visible on the map. By clicking on it the bottom menu will appear as in the first screen in example picture...
Then if the user drag up this menu then the more detailed view will cover the half of the screen.
And by dragging up again then the full screen will cover up with activity or by fragment and the toolbar name is changed...
As seen in the example picture.

libGDX, Scene2d Button status

Hello I have some questions for adding images for a ImageButton.
I have an icon for example a play button now if I hover over the button it just should get a blue surounding box the inside Image should not change.
Should I draw for every icon the two states or are there other options.
If an button is not clickable it should get Grey. Same how to do this? Add an additional Image to every Icon?
For what is the Checked drawable in the ImageButton?
ImageButtons have a drawable for their background (up, down, over, etc.) and a drawable for the image on top of the button (imageUp, imageDown, imageOver, etc.). The only ones you must provide are up for the background and imageUp for the icon. These are the defaults used when you leave the other states null. But for visual reasons, you need down for the background or it will be hard to tell if the button is being pressed. It's up to you whether you think you need to also change the icon appearance with an imageDown.
All you need is to add the background drawable for disabled. If you want the icon to also turn gray, you need to create a gray version of the icon and assign it to imageDisabled.
The Buttons in Scene2d all support toggle functionality. When you press it, it will toggle to the checked state, so you can use the checked drawable to change its appearance while it is stuck down. If you don't want that to happen, leave the checked drawable null.

Android Button background Image changes back to state in XML

I have a simple soundboard which uses Buttons to represent the sounds. When a sound button is clicked. The background image is changed using the view.
Button butt = (Button)view;
butt.setBackgroundResource(buttons_on[media]);
buttons_on is a int[] representing the drawables of the buttons.
This all works perfect, but I also use a FragmentActivity to create a paged App. The App has 4 different pages which you can swipe through. When I change a button using the above code and swipe two pages to the right and than swipe back. The image of the button has changed back to it's default defined in the page.xml.
How can I prevent this behavior?
change the Buttons to ImageButtons and setting the src?
somehow prevent the page from reloading
Instead of doing that you should look at how to use a StateListDrawable. It will simplify your approach.

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

Categories