How to assign a Photoshop designed button in android studio? - java

I have designed a main menu screen for my app, including the buttons and background and I want to know is it possible to link these buttons directly from background without putting each one of them in draw-able folder?
or do I have to put each one individually?

same as eclipse put png file in drawable folder and set ::
android:background="#drawable/imagename"

Copy and paste all the files into your drawable folder and then link them to your xml attributes using.
android:background="#drawable/filename"

Related

How to open a file .svg in the app in android programmatically?

How to add a file with the extension svg and be able to change and edit all its items?
I mean, I want to add a svg in Java code and make changes to it.

Libgdx android icon not being applied

I made a game and now I want to change the icon, so I replaced the icons on res/drawable (with the same file name). But when I run the game on my android phone it still installs with the default libgdx icon and not my own icon. Then I tried to change the icon names and also making changes in my manifest file.
<application
android:allowBackup="true"
android:icon="#drawable/loh_icon" //loh_icon.png is my icon name
android:label="#string/app_name"
android:theme="#style/GdxTheme" >
Still the same problem, how can my game still have the default libgdx icon? I deleted those icons and replaced them. I also invalidated my intellij caches and restarted.
If you look in your android/res folder, you'll see 5 different directories starting with drawable. The part after the dash is the screen density.
Inside each folder there is a file called ic_launcher.png with a size for each screen density. This is why by default, you'll find this in your manifest: #drawable/ic_launcher. You'll need to make different resolutions for different densities, and replace them.
You can use this online tool to automatically do it for you: Android Asset Studio.
Make your icon and click the download link. Open the ZIP file, and extract it to your res folder.
You can delete the drawable folders. Go into your manifest, and set your icon to: #mipmap/ic_launcher
In Android Studio just right click over android/res -> new/image asset, on dialog choose icon_laucher and the radiobox for image, there you can select whichever image you want. Android will make all different images for you
Some phones will cache app icons. This means that it might keep showing you the old app icon even after you change it.
Try restarting the phone. Alternatively, you can try changing the theme of the phone if it has such an option (e.g: MIUI)
Android API 26 introduced adaptive icons:
https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
libGDX provides new files that handle this. Use the libGDX setup wizard to generate a blank project to see it. The files are stored in:
android/res/drawable-apydpi-v26
You can edit ic_launcher_foreground.xml and ic_launcher.xml to set it up for API 26+ devices.

Drag and Drop in Android Studio layout editor

I have a problem with adding images to my app's layout. I've searched for an answer for a while, but even when doing exactly what friendly people of the internet told me, there is still no success.
images are in PNG format in res/drawable folder.
im trying to drag'n'drop them into the content_*.xml preview.
i can add elements from the palette.
i am using RelativeLayout.
Any idea what may be the cause of this problem?
View of my android studio screen:
You must store your images on Drawables folders not in drawable
-drawable-hdpi,drawable-mdpi,drawable-xhdpi.....
You should drag an ImageView, then add the image with the src param. You can't directly drag and drop images
You can't add elements in "Palette".
RelativeLayout... Okay, whatever layout it's good
UPDATE1
To see the drawable folders you must clic on arrow (see image1) and put on "Project" (image2)
----------> see point 1.
Yes you can drag&drop that elemenst, TextViews, ImageViews, Edittext....
you should drag an ImageView, then add the image with the src param (you can do this in the right menu or with xml)

How to use single drawable for all screen resolutions in Android programming?

Android programming in eclipse, java, xml etc. I put all the drawables (images, xml files etc) in all the folders: mdpi, hdpi etc. So I have 4 copies of each file.
Is this absolutely necessary ?
Is there a way I can put them in a single "drawable" folder ?
Or will android understand that if the file does not exist in hdpi, it should fetch it from mdpi, or wherever the file exists ?
Yes, it will fetch the appropriate file if that particular image is
not available in other folder. But it need to atlest in one folder(drawable OR mdpi OR hdpi OR ldpi ...)
Yes you can put all the images in single drawable folder.But in this case if you have a low resolution image this will be look as faded image in the case of tabs
so if you want your application support in all devices, Tabs then you have to put images in different drawable folder like as drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi
Why not use https://code.google.com/p/9patch-resizer/ to automatically resize your images to all resolution compatible for android development?

Creating a Gallery in Java - Netbeans

I don't know very much about Java (I know the basics). I want to create an Image Gallery with Netbeans, but I have absolutely no clue how to do this.
What I want to do:
The User should see all Images inside a specified folder (as thumbs) and should be able to view it in "original size" upon clicking on the Photo. Also (via a Button) he should be able to "transfer" an Image file to that folder.
So basically I have a database of misc. articles, each article has some Images in a unique folder on the Filesystem (eg. /images/art_01), I want to display all images within this folder and have the possibility to add (speaking, copying) new Images into this folder (there is no need to delete an Image) arranged, so it doesn't look too disgusting ;).
Since I just now the basics of Java, I qould appreciate if someone could help me, with something I can adapt directly into a JFrame - if that's possible.
Thanks ;)
With netbeans it's really easy, netbeans has a JFrame/JPanel drag&drop designer/gui builder (right click on package -> new -> JFrame form). After customizing the GUI you can make your main class extend your custom frame, or add a new custom panel to your JFrame, depending on whether you choose to make a JFrame or a JPanel.
http://netbeans.org/kb/docs/java/quickstart-gui.html some details on how to use the netbeans gui builder.
With this builder you can also add events to the different components. If you want to view a directory use JFileChooser.

Categories