How to stop other elements moving around when moving an element from relative layout in android studio? - android-layout

I am new to Android Studio. I am trying to make a basic application that adds two numbers, but each time I move something around, The entire layout gets messed up.
I added a separate View in the center to act as a reference point to counter this, but it is still getting very annoying.
Any idea on how to fix this? I am using Studio version 2.1
If not, is any other way to design the user interface without having to deal with relative layouts?
I have tried linear layouts but those only allow me to place my elements in fixed places which I cannot use in my app.
Please guide me.
Note: I apologize if this question is too simple. I am a newbie after all, do forgive me.
Thanks in advance!

This is indeed the function of RelativeLayout in Android Studio. If you are getting problems with dragging and dropping with RelativeLayout then you should try any other layout. eg. ConstraintLayout
2nd Solution:
Try adding new buttons instead of copying and pasting old ones.

Have you tried using margin: http://android4beginners.com/2013/07/lesson-2-2-how-to-use-margins-and-paddings-in-android-layout/
also look you can align certain object in the xml code relative to eachother, have no link for that atm

Related

FlexBox Layout Android. How to delete vertical gaps between views?

I'm generating Views inside FlexBox layout by pressing the Start button. As you can see every item on even line has random size. It works almost as it supposed to be but there is a problem, I need to get rid of vertical gaps between two vertically adjacent views. I've tried all properties of Flex Box Layout but didn't find one that can help to solve my problem. I will be happy if you help me to solve this problem.
I've solved this problem. If you have the same task you should use Relative Layout and its' flags inside your android code. It'll give you all control under the positions of Views. If it will be necessary I can expand this answer to provide more detail.

Adding a text box in Android Studo

Trying to use AndroidStudio (3.4.2) for the first time and it appers to be substantially different to the tutorial at
https://developer.android.com/training/basics/firstapp/building-ui
For example:
There is no layout editor toolbar let alone a show button.
There is no autoconnect button
It doesn't show any wiggly lines from the middle of the blue square to its edges.
When adding a text box it goes to the top left and can't be moved.
WTF is going on? This is awful!
So I know this may sound like the hard answer, but in the long run it will make life 1000x easier.
You need to learn XML to design the activities. It's fairly simple and really easy to research. The reason the textbox can't be moved is because the default layout is ConstraintLayout. In order to fix this, go to the xml file and change the Constraint layout to either Relative layout or Linear Layout. In the end, its more simple to learn straight xml.
I suggest you learn Android programming from here or somewhere else because the Android documentation can be confusing especially for a beginner like yourself and trust me, I've been there.

Drawable icons for app

Recently, I've been working for some theming project for Android launchers. I need some guidance and advice from the people around here that could help me with this.
I have created one sample icon for Opera mobile with the size of 192x192. The question is, if I made that icon size as mentioned, should I create another size for it, e.g. 128x128? I'm a bit confused.
Thanks.
I am not sure if understand your question. If you add a drawable resource to Android Studio, it automatically resizes it to multiple sizes. If you have created one, that will be resized automatically.
Hope this helps.
If you want to design icons for android, you better design some for different resolutions. You have to make an icon for each. See at this article https://developer.android.com/guide/practices/screens_support.html#overview. There are the different densities and the multiplication factors.

Why can't I size android components at will?

Okay, so I'm really trying to do a lab for a class thing and I don't get why I can't have a textbox that takes up the width of the phone and a button that takes up the width of the phone on the bottom, but I don't know why that is? Here's a picture of what I have.
I know this is a noob question but it hasn't been addressed yet on the online course I'm taking and I really need an answer because I wanted android development to be as easy as .NET on windows.
Well anyway here is one picture:
Also here is the other picture:
Notice if I try to make one element bigger, it leads to it pushing the other one out of the activity, I want to have one activity with both elements taking up the entire width of the phone.
Does anyone know what I'm doing wrong?
EDIT: I'm using Ubuntu 14.04 not Mac OS X.
Your controls are children of a LinearLayout with android:orientation="horizontal". This means that the parent ViewGroup is aligning them horizontally; you cannot get the children aligned vertically in this configuration.
If you change the attribute to android:orientation="vertical", you will achieve the result you're looking for.
I strongly suggest getting yourself familiar with the default set of layouts available in the Android SDK by reading this official guide.
Edit : Please refer to this answer for placing views at bottom of the screen.
When you use a android:orientation=horizontal orientation in the layout, the views are stacked/placed in a single row. Since both your views have their width set to fill the screen, only the first one is shown/seen.
What you want is the vertical orientation. This places the views in a single column, one below the other. The width set to fill-parent will allow you the view to occupy all available space.
Official documentation on views : Layouts : Android Dev Docs
Understanding Android Layouts : Techtopia
Android Layout Tutorials : Learn-Android

Android - Set Default Spinner Themes

I'm new to Android development.
I'm using drag and drop to pull down a default spinner onto my layout.
However, the default is not the one I see everyone using with the triangle on the bottom right.
An example of what I see is:
http://www.mkyong.com/wp-content/uploads/2011/11/android-spinner-demo1.png
Whereas what I'm looking to achieve is this:
http://i.stack.imgur.com/X82Ld.png
Is it a styling issue?
Apologies for ripping off other people's images, I don't have enough rep for uploading my own images.
Thanks so much!
I've Solved my issue by setting the Theme of the application/activity to Holo.Light. Hope this helps other people in the process.

Resources