I'm working CardView.Everything workng perfect but i have one problem(question)
I only have png image.How i can solve my problem? is it a possible to use .9.png in my cardivew?
Sure You can use .9.png format Or use this link for making 5 diffrent screen size image for your app. LInk:
Link
I made simple menu icons which look the way I want them to look when in Illustrator, but when I place them in my app they look pixelated and bad.
Here is it in my app (as you can see, the text is not pixelated):
This is how it looks in Illustrator (I cut the icons and pasted them next to the other two, that's why the background is in different color):
I made the icons on 72x72 px canvas and exported them as .png file.
I am using Android Studio to make my app, and use simple
android:background="#drawable/back_button" to set the image/icon for the ImageButton.
I never try Illustrator to put icons, but I am directly download icons from flaticon that provides any type of file and size too
Two way to get different canvas file in android studio.
Android Studio-> File-> Image Asset or Vector Asset
upload your file and set as you need
Icon Generator
From this you can get directly res folder with different canvas image.
Mostly I prefere first.
Thanks
these icons as shown in fig. have a background color assigned by you in illustrator, no matter these are exported as png format or jpg!
First go back to illustrator and try to make background of images transparent as you assigned greyish color, tell me if it works. That's great you are making icons for yourself. Good work.
I think when you save the file please try to save it (SVG) format & then place it.
I have a .png logo for my app which doesn't have a background, when I add it to android studio as an Image Asset I am forced to have a background. The hex field doesn't accept 8 digit color codes, 6 digits only. Is there anyway to keep the background invisible?
To make background transparent, set shape as None.
See the image below:
EDIT:
For Android Studio 3.0,
you can set it from Legacy Tab
I'm using Android Studio 3.0.1 and if the above answer doesn't work for you, try to change the icon type into Legacy and select Shape to None, the default one is Adaptive and Legacy.
Note: Some device has installed a launcher with automatically adding white background in icon, that's normal.
You have two ways:
1) In Background Layer > Scaling, reduce the Resize to 1
and then in Legacy > Legacy Icon set Shape as None
2) in Background Layer > Scaling > Source Asset, you can set an image as a 1x1 pixel (or any size) transparent.png image (you've already created).
and then in Legacy > Legacy Icon set Shape as None
the above approach didn't work for me on Android Studio 3.0. It still shows the background. I just made an empty background file
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
</vector>
This worked except the full bleed layers
This is just another workaround.
For the 'Foreground Layer', select 'Asset type' as text and delete the default text in the text field.
For the 'Background Layer', select 'Asset type' as image and now choose the path of the image you want as an icon.
And you are good to go.
Android Studio 3.5.3
It works with this configuration.
I Just put my view background (color code) as ClipArt or Image background, and it looks like transparent or no background where both have the same color as background.
These are the steps I took to make an image transparent:
1- I used an online website which makes the image transparent, there are a lot of them. For me, I use this https://www241.lunapic.com/editor/?action=transparent and sometimes this http://www.online-image-editor.com/help/transparency
2- In Android Studio (I'm using version 3.1.3), open Image Asset from app > res (right click) > New > Image Asset
3- In the Path, choose the location of the transparent image which you downloaded from the online website, and make the other options as shown, then Next, then Finish. The five different sizes of image mdpi(48×48), hdpi(72×72), xhdpi(96×96), xxhdpi(144×144), and xxxhdpi(192×192) will be created in the res/mipmap-density folders.
4- If you need sizes (dimensions) different from above, you can use this website http://nsimage.brosteins.com/ to upload your PNG image of biggest size that will be used in xxxhdpi. After uploading, you can download a zip file containing the five different sizes of image in the res/drawable-density folders.
First, create a launcher icon (Adaptive and Legacy) from Image Asset:
Select an image for background layer and resize it to 0% or 1% and
In legacy tab set shape to none.
Then, delete folder res/mipmap/ic_laucher_round in the project window and Open AndroidManifest.xml and remove attribute android:roundIcon="#mipmap/ic_launcher_round" from the application element.
In the end, delete ic_launcher.xml from mipmap-anydpi-v26.
Notice that: Some devices like Nexus 5X (Android 8.1) adding a white background automatically and can't do anything.
With "Asset Type" set to "Image", try setting the same image for the foreground and background layers, keeping the same "Resize" percentage.
I just added the icon as a normal icon: New -> Vector Asset
and then change the app icon in the Manifest file.
For Foreground Layer choose "Text" and then delete the content text
Finaly choose the path of the image you want as an icon.
enter image description here
Using android 3.0.1
I noticed this weird behavior(solution),
First: in background layer in the source_asset change the asset_type from image to color and than change it back to image.
second: enable trim in scaling and then resize it to a small percentage and it will work perfectly.
PS: If u didn't do the first step the scaling wont take affect.
and if anyone have an explanation for this please provide.
steps
I have a problem for set an image in background. I use background tag but there is an error I don't understand! see below pictures.
Sometimes resources get out of sync with the file system. Do a refresh (select project in resource explorer and press F5).
Use the following tips.
Resize the background image in to a smaller resolution and size.
Use only *.PNG images.
Try to clean your project from Project>Clean..
I have an image that is circular and I want to make the other junk in the image to be transparent. I've spent the last hour looking around and I can't seem to figure out how this is done for android. Any help is greatly appreciated!
I haven't worked with Android but on iOS pngs weren't loading for me when I made them in photoshop but when I made them in flash all of a sudden they would work! Try that first :)
Anyways, you want to google something along the line of "pixel arrays android code" you can create an array of each pixel, find an individual color, then make it transparent...
But I really think this is just a GIMP issue and you don't need to go through all of that hassle.
what i can understand from your uncleared words is that you want to display transparent image of a normal image you have . so i would suggest don't do it through programming . create a transparent image through any image editor tool and use it .
if image is dynamic that you cant go in this way so use Matrix and setAlpha . search over net for both the terms