Android development, graphical layout? - android

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 ;)

Related

android studio issue: complex Layout is not showing in design view but just as XML

I have a somewhat complex layout.xml file (353 xml lines, 16kb) with multiple nested constraint layouts. This particular xml file is only showing a blank white screen in the design tab but works well when I run it on device and emulator. I have other smaller layout files which show the design normally on android studio but it seems that there is a bug with viewing larger xml files.
Is this a known issue? I tried refreshing layout and removing android studio cache but nothing seems to work. any ideas?
I do not think it has anything to do with the code since it runs normally on device and I am not sure posting the whole xml file on SO is a good idea.
update
What I realised is that all the elements in the layout seem to be 'invisible' at the top left corner since when I hover over them the pointer turns into a hand and when I click , certain elements get highlighted in the component tree. This is a screenshot of what I am seeing:
I added android:visibility="gone" which is vital to my app. Little did I know that it also applies to the design view which I find to be really useless. I want the visibility to be gone during runtime, not on a platform where I am supposed to be tweaking the design of the UI. This is ridiculous to me.
Does anyone know If I can keep visibility="gone" but still see the design in the design view of the layout?
You can use tools:visibility="visible" for designing purposes.
It has zero effect on the view in real use.
Don't forget to keep your android:visibility="gone".
In general, use tools attributes whenever you'd like to manipulate a preview in the designer while keeping your view attributes valid for real use.
Edit:
Keep in mind that there is a huge difference between invisible and gone. More about that

Android studio My app is displaying incorrectly.

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

Possible to rename widget after laid out in RelativeLayout?

Working with Android for the first time, I've blocked out a layout using the relative layout and laid down some buttons and text widgets how I like them. However when I go back to rename the IDs the layout goes all crazy moving elements around and in general destroying the hours of work I spent laying them out.
Does anyone know how I can rename the widgets without Android destroying the positioning for widgets in the Relative Layout? Is this some "feature" of Android? I can't imagine why it would be hard for the UI builder to handle simple renaming of a widget ID without destroying the positioning information.. Do I have to use an external text editor and modify the XML files directly? Ughh I hope not.. I'm using Eclipse IDE.
You can use find and then replace all to change the names every place that they appear. Shouldn't take anywhere near an hour if you're dealing with a small layout.
In general the graphical UI creator that is currently included with the Android SDK is not so great for creating anything but very simple layouts. In my experiences (which were a long time ago, it may have gotten better since) it was terrible with RelativeLayouts.
If you have not modified your xml directly then it is time that you jump in and start learning to do it that way. You'll find that you have a much greater level of control over your layout, and once you get the basics figured out you'll probably be able to create quicker using raw xml then with the graphical tool anyway. I do wish that there were a nice GUI creator for android out there, the best one that I've ever come across is Droid Draw which I found to be better than the one included with the SDK, but still not as good as I was hoping.
To modify the xml directly you don't need any additional text editors, you do it inside eclipse. Open up your layout file and at the bottom click on the tab that says "Source" when you want to switch back to graphical (good to see the changes that you make to the xml graphically) just click back to the tab that says "Design"

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/

The Eclipse XML Graphical Layout Editor for Android SDK

I am trying to use the Graphical Layout editor to make my app, so far so good but now I am in this problem:
I want the grey small textview to go a little higher but no matter what I do this isnt happening. How do those apps in the market have such beautiful GUIs when I can barely create a simple one? What are they using that I am not? :P Thanks.
Well, To fine tune the UI, you will eventually have to edit the generated XML. It would be good if you start getting your hands dirty with the XMLs. Please post the XML and then anyone would be able to suggest what changes to make.
I think you would probably reduce the padding or margin of the textview above.
Have you tried editing the XML and decreasing the top margin of the text? Or decreasing the bottom margin of the view above the text?

Categories

Resources