Android studio My app is displaying incorrectly. - android

I am trying to learn to make my own apps by following tutorials but i have an issue when i run the app in the emulator or on my phone. All theScreenshot contents of the layout are squished in the top left corner.
This is all the codescreenshot 2here. I am a noob so don't go to hard on me. Thanks

It would be better if you also post your layout code (activity_main.xml) here for this kind of problems. But I am guessing you are using constraint layout as root of your layout and its child views are not constrained vertically, so all of them go to another position in run time.

Maybe you are using a relative layout and no positioning is specified.
You should paste the xml's code

Related

Buttons not visible on the application. What's wrong?

I created an empty activity for 'My Testing App' and it looks like the following in the preview section:
But when I generated a build apk and used the same in my cell phone the result was like the following:
I can only view the exit button on the very top left but the two other buttons, that should be above it are missing.
I tried to rearrange the icons on the screen as well. I made them to go to the bottom, to the right most, but I see no change when the apk is reinstalled.
How do I make them visible on the hardware?
Here is the snap of the code for this activity:
To quickly add constraints to your layout just click on the Infer Constraints button in the Layout Editor toolbar. Learn more about the feature here: https://developer.android.com/training/constraint-layout/index.html#use-autoconnect-and-infer-constraints
Right Click on you Layout and select "Convert View" Option.
then select "LinearLayout" Option.
it will show all three buttons in the output.
You have to learn about ConstrainLayout in Android
View in ConstrainLayout is not only drag and drop. You should link the constrain line in each view to reference with somewhere on the screen.
Any XML attributes prefixed with tools are removed when the app is compiled and are only rendered by Android Studio layout editor.
You need to properly set constraints in your ConstraintLayout, not use absolute positioning.
Or you may instead use RelativeLayout, LinearLayout, etc.
https://developer.android.com/training/constraint-layout/index.html
Start by reading this. Most of what you need is answered here. The problem is that your views are not properly constrained (basically they aren't linked to anything so when you run your app it doesn't know where to place them and just defaults to the upper left).

Recently Android studio 2.2 - Unable to drag views around in layout file

I updated to 2.2 literaly 30 minutes ago and when I tried to move widgets around in layouts,
this happened:
https://gyazo.com/d3c640cca6f212aaa9effe2db9bccb98
I can't center it or even move it to the right,center,etc. It's always stuck on the left.
What's wrong with it? any ideas? should I uninstall Android Studio and re-install it again?
You Should Post your layout.xml file here, But i think you should go and change the layout in the layout file from linerlayout to the Relative Layout .
Linear Layout puts widgets one after the other.
Relative Layout puts stuff or widgets relative to the other widgets on the page or the relative things like centre of the page or 5dp below another widget.
Hope it helps :)

How to scroll a scrollable layout in the Android Studio?

I've imported my Project form Eclipse into Android Studio and I can't find the way to scroll my scrollable layout in the program (of course I am sure it is scrollable - I can scroll in the Eclipse and on a device).
According to this change set: https://android-review.googlesource.com/#/c/61089/ , there is a fix for this coming soon. I'd hazard a guess you'll see the fix in 0.1.7.
The fix bkromhout mentioned only works if the ScrollView is the root of the layout. I had put mine on top of the default RelativeLayout and had to manually fix that in the XML before the GUI would give me the full view. I hope this helps others who did the same.

Android development, graphical layout?

Hi im just starting to make an app, and on eclipse i get 2 tabs. Graphical layout is one of them. I see a black cell phone screen and some buttons and text stuff to put on it. What is this for and how do i use it? Thank you
With the graphical layout you can just drag and drop items in, and the xml is the actual code. Adding things via the graphical layout will edit your code for you, and visa versa. Personally I prefer to just use the xml because the graphical layout can be a little difficult to get the results you want, and it's always useful to have a good understanding of the xml code and how it works.
Android uses XML layouts. They can be a real pain to edit. The graphical layout tab with the picture of the phone is supposed to make it a little easier.
Sometimes you still have to dip down into the XML to get things just right, but the graphical layout will at least give you a preview.
It's your Interface Builder.
It builds interfaces ;)

My Relative Layout Design shows messy view of my widgets in graphic Layout view (Layout Editor) but it works well in emulator

I am trying to develop a RelativeLayout in the Layout Manager of Eclipse(Galileo) with Windows XP
My RelativeLayout consists of
some TextViews
some LinearLayouts , each Layouts in turn contains some Buttons and TextViews
I have arranged it with the reference id one below one using property:
"layout Below & Layout above etc.,.
But in Layout editor it is showing some messy type and it looks fine in Emulator
How can I arrange it well and good in the Emulator itself.I have spent some 2 days for this. can't get anything
Is this a system error? Or, are there any techniques to handle the RelativeLayout?
Guide me.
Thanks in advance !!
https://docs.google.com/open?id=0B_W2CaYMJagaZTVjMzY1YmMtMDE2My00OGQzLTkxMTEtMmYwMTVkNzFhZTgz
https://docs.google.com/leaf?id=0B_W2CaYMJagaZTFiMTRkYWUtNDYwNi00YjY3LWI3MjctY2NkZWFjYjI3MjNm&hl=en_US
This is the Url I have posted my screen shots.. for Your reference
It is the same situation for me trying to design relative layout with eclipse. Try to post your question on Eclipse forum . It's not important issue for me, but if you'll find the answer - it would be great.
The layout editor is not really all that reliable, especially for relative layout. It's nice for some simple layouts, but a lot of the time with more complex layouts it won't render correctly. If you're doing anything complex, you pretty much have to get a feel for the XML elements, use them to the best of your ability, then try in the emulator (or on a device).
Also you could use tools for layout creating.. for example http://www.droiddraw.org/

Categories

Resources