Splash with 9 patch ruins next activity - android

I have a splash screen with my company's logo in the center of it with a little progress bar under it.
I launch the splash as the first activity, and before that happens I display an image of the splash (without the progress bar, just the logo) using the app's theme background.
I placed a 9 patch image of the in the app's theme android:windowBackground, and when the extension of that file is .9.png - the splash activity is displayed on the top left corner of the screen in a smaller size.
Changing the extension to .png makes the splash display correctly over the whole screen, but of course my first image is stretch horribly ,because it's much smaller than the screen.
Exmaple:
This is the logo
The picture below is how the app looks when the splash has been loaded and I am using the .9.png extension
The picture below is how the app looks when the splash has been loaded and I am using the .png extension
The pic above is how I want the splash to look, but without the .9.png extension the app looks like this (picture below) before the splash loads
Anybody experienced this issue? Couldn't find it online.
Thanks for the help.

Solved the issue. Instead of changing the app's theme's windowBackground to my 9patch image, I added a new theme with the 9patch background and attached it to my first activity.
So the basic rule is, don't put a 9patch image in the app's theme background. Place it in the first activity's theme instead.
Source for this solution: https://developer.appcelerator.com/question/149184/9-patch-splash-screen-initial-window-does-not-fill-screen

Related

Removing Grey and White Chequered background in Android Image Asset Studio

I am trying to remove the Grey and White Chequered background from a launcher icon jpg file using Android Studio's Image Asset.But no luck so far.
Is there any way to do this?
below is the Background :
The checkerboard background is for transparency. Same happens in paint.net. If you end up with transparency, you get a checkerboard like that of white and grey.
It is technically not a background, you don't actually see that in the launcher. Alpha shows as a checkerboard to ensure you know you are seeing alpha. If you install it on a device, you can see what is "under" the launcher icon. If your icon is 256x256, and has a 10x10 square of transparency in the middle, you will see a checkerboard there too. If you then launch it on the device and check the launcher, you will see that there is a see-through hole in the middle.
Basically, the checkerboard isn't a background - it is transparency.
With the exception of the times where you actually create a checkerboard on purpose, but that can then be deleted by modifying the .png file
Right-click on image, form the menu that pops up select Hide Chessboard.

Android Studio adds white background to PNG image. How to fix it?

I have a PNG logo file that I want to display inside navigation drawer. But whenever I add the image asset to "mipmap", it adds white background and bounding boxes around the image. How to fix this?
Original Image:
After adding as image asset to Android Project's "mipmap" folder:
The 'mipmap' folder used ONLY be used for App icons. And these icons HAVE to have the same width and height. If they aren't, Android Studio will add extra white space to them.
Create a new icon that is square, but simply make some of the image transparent. Then you'll get your desired effect.
It is because the Shape property was set to Square by default. I changed it None, its fixed now. Thanks for responses.
Run the app - if it still shows - use PhotoShop to make the png.. your png is not made correcty
The problem is when you add it as an image asset as launcher icon it adds white background to the image sometimes if the image isn't of the specified size. Use this option only when you're adding launcher icon, use action bar and tab icons option that won't add any white background to the image, select the theme holo_light theme will make the image dark, and holo_dark theme will make the image white, don't worry you can change the color of image of any custom color by selecting the custom theme while uploading or, you can use the android:tint attribute in the layout file. And add app related graphics in the drawable folder only.

Android Images scaling

I always have problems when using images. I want to use an image as splash screen. So I imported all resolutions (ldpi to xxhdpi) of my image using Multisource-Drawable in Android Studio. Then, I created a imageview in my Activity and set Width and Height to 150dp both. It seems to use the ldpi resource and the image get very blurry.
What's the best way to import images in Android Studio to general use?
[UPDATE]
Android is chosing the right size, but not how I want. I fixed it by adding a 512x512 png file and then setting its Width And Height to 150dp
I think your question may have two separate answers. First, you are assuming that an image is the best way to set up a splash screen. This is not so, as the content would have to be called after the app has already finished setting up. That would mean your user sees a flash (or more) of a blank screen before the splash screen is shown. Second, you would like to know the best way to import images into Android Studio. Here are the two different answers:
#1 The best way to implement a splash screen is to have a theme called on a blank activity. The theme would include your desired image and background color. The reason for this is to eliminate the short break before content is called. Click here for a link describing more and giving a tutorial.
#2 In my opinion, the simplest and most robust way to add an image resource is to use the Image Asset import feature. Follow these steps:
Right click on "res" (in the Project View) -> New -> Image Asset
On Icon Type choose Action Bar
and Tab Icons
For Asset Type choose Image
Choose the image path (on your computer)
Give your image a name (no UPPERCASE, only lowercase and underscores, etc)
Next -> Finish
make image view height and width wrap_content and set its gravity to center..

How can I get rid of transparent background space in (Android Asset Studio - Icon Generator)?

When I upload my image (which has no background to begin with), it is automatically given transparent background no matter what settings I choose. I really like the "Square" shape (rounded corners) but there is way too much excess transparent background. When I see the icon on my phone it looks so small compared to Facebook for example. How can I get rid of this extra background space to make it as large as possible? Is one of my settings off?
http://reiszecke.github.io/AndroidAssetStudioFullsize/
Just click on >> Launcher icons << Full Size edit
pls mark as answer if it helped.
EDIT: only works on "bevel" and "none", I will adjust the other shapes at some point
http://www.gieson.com/Library/projects/utilities/icon_slayer/
Does the job but the an image must be provided first.
Creating the logo and background with LIG and loading the result in the gieson's icon_slayer should do it.

Android Transparent png doesn't show as transparent

I'm using an image with transparency as a ImageButton in my Android app - but when it appears on the android screen - it still has a whitish surrounding border.
I even changed the image to one of the template ones supplied and that still is not transparent (although it is in photoshop).
Am a missing some declaration or something ?
I tried in both the emulator and also running on my phone and its still shows as white on the black background.
Cheers
ScottyB
The whitish color IS the button part of the image button :)
Use regular Button and set your image as the android:background of it. Don't set any text.

Categories

Resources