Drag and Drop in Android Studio layout editor - java

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)

Related

icons are showing in full black color in android drawer bar do you know how to fix it?

icons are not showing in activity main drawer they are just showing like full black i dont know why can anyone help me? here is my xml code.
enter image description here
This is because you are using .png files which are not supported by navigation drawer. It only works with .svg or Android Vector Asset.
If you want to use these pictures, you need to convert them to .svg file from here.
How to convert ?
Scroll down and you will something like this ->
Click on Choose a file and pick the image you want.
Once you select, you will see this below it -> (I have used my image)
Click on the Generate button and wait for a while->
Once you see an image in the side, you know that it has been converted ->
Click on the Download SVG button and you will find it in your file explorer.
Once you download them, you can add it to the drawable folder. But make sure that you delete the previous png files.
Tada! Its done! You them in the navigation drawer and you get the icons too!

How to add image in front of screen - Android

Click to see image
How can I add images and videos like this? Is there any keyword to look for tutorials?

How to Make my developed app rotation work properly

When I run the app on a real device and I rotate the app to landscape mode most of the content is been cut off and I can't even scroll on the landscape mode. What XML or java code can I use to make the app rotate without loosing it content?
Please check the attached image to understand what I mean
In the folder "res":
create a new folder named "layout-land" where you copy the layout (the layout need to have the same name).
Modify the content of the layout as you desire to fit the landscape.
When you rotate your phone, the system will detect that it exist a layout land folder and a layout adapted for landscape.
Can you post your layout code? I will help you to organize the views.

How to assign a Photoshop designed button in android studio?

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"

ActionBar Icons having different sizes

In my android application, some of the action bar icons are at normal size (like the star in the screenshot) and some are too small (like the browser and the share icon in the screenshot).
All of the Icons are added in the exact same way:
menu.add(getString(R.string.sync)).setIcon(R.drawable.ic_action_sync)
This happens in three of my activities with different icons. The image files are in the correct directories for their density, they are all from the ActionBar Icon Pack and do all look the same size in the directory on the computer.
I use ActionBarSherlock to display the Actionbar on Gingerbread, but it looks exactly the same on ICS/JB, where ActionBarSherlock should use the native ActionBar (so I guess it's not ABSherlock's fault).
I have no idea, what the reason of this could be.
It looks like your icon drawable resources are not the correct size. To fix this, you will need to recreate your icons.
When you do this, be sure to check the Android Design- Iconography page to ensure that you are creating your resources at the right resolution.

Categories