For Android in RelativeView , some attributes arent working. It keeps saying they aren't declared. How do i fix this?
This is in VS community 2015 with Xamarin
That's fine. It will always say there are some errors but it will compile. I usually use Android Studio to edit those XML files and paste to VS. The VS designer is not as easy to use as Android Studio's.
But here Relative Layout do not have Orientation, that's for Linear Layout.
Related
I am new to android development. Also new in using android studio.
And when I started to create a new project, the content_main.xml and does look like this
But not to other xml
And here is the output
How can I even edit the layout, when I can't see it. Also when i drop anything from the palette, I cannot see it.
Try to change the android version to some lower in xml.
Change from 28
Do not use content main. It is for including inside activity_main.xml. Make everything inside your main layout and finnaly you can see the result.
And don't forget that ConstraintLayout needs constraints for all elements.
First of all read about other layouts and learn how to use them.
I learnt about Relative and LinearLayout, but now the newly upgraded android studio 2.3.. is automatically using this constraint Layout which i know absolutely nothing about.
Why does the constraint Layout choose automatically what i need in my own project? Is there any way to use my android studio without these constraint layout? which is by the way, very annoying!
ConstraintLayout is similar to RelativeLayout. ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy,
Here is official tutorial for constraint Layout.
If you wish to change default layout. You can do that by editing default template file, which are located in:
...\Android\Android Studio\plugins\android\lib\templates\activities
replace ConstraintLayout with RelativeLayout (or your favorite layout!) using any text editor.
for detailed information please refer this answer
I had to edit the Constraint Layout XML file by hand (*), so I also removed all the tools: fields from the XML. To my understanding these attributes are only used by Android Studio and the Constraint Layout tool. But I removed them because I wanted to reset the state of the layout and changing the android: properties for the Constraint Layout surely would only mix things up even more, right?
So I am now in a situation where the blueprint view stays empty and the hierarchy view says "Nothing to show". I see no view properties and no constraints. I can only see the flat UI design view of the layout, but I can't select any elements from it either.
Any ideas how to fix this?
I am running Android Studio 2.2.3 and Constraint Layout beta 4.
*) Why did I edit the layout by hand you ask? Well, I selected "Convert to Constraint Layout" in which case Android Studio just flattened my layout and hard coded the positions of all elements. Which wasn't exactly what I wanted since then I couldn't change the positions anymore. Removing the hard coded positions (and the tools: arguments) let me re-structure my layout.
Ok, I am going to answer this myself since I got it working thanks to Nicolas Roard who works on the Constraint Layout team at Google.
try pressing "r" [in the design view]
https://twitter.com/camaelon/status/809427379500126208
I wasn't aware of the keyboard shortcut "r" in this case, but it did solve it for me!
I'm using Xamarin for developing android application. I want to switch to Visual Studio(2013) because is more familiar to me, but I have a problem when I try to edit layouts. The designer doesn't load at all, I view just an empty rectangle on the layout, even if in code the xml is present with all elements.
What I'm doing wrong? I should connect visual studio with Android Designer?
Thank you in advance!
Images of layouts - design and xml (I cannot add them here :| )
1. Designer - http://imgur.com/B0u5XaC,pGMJuky#0
2. XML - http://imgur.com/B0u5XaC,pGMJuky#1
Ok, I fixed it. I'll post the solution, maybe it can help others - the problem was related to sdk v.23.0.5. I downgrade it to 23.0.3 and now it works perfectly!
I'm new to developing with Android, and the biggest new thing is the way the UI is rendered (relative to other views instead of absolute locations and sizes). As a result, I've been experimenting a lot with layouts, and find myself changing 1 view or even just 1 property of a view, then having to recompile and launch it back into the emulator to see the result. Is there a tool that quickly (or at least quicker) shows what a UI looks like give a layout xml file?
You can look at http://www.droiddraw.org/ but it is not perfect.
You can use Eclipse with Android Development Tools, when opening a layout file you get a preview of what looks like. Besides, ADT provides some nice features for developing and debugging in the Android platform.
When you're in the XML view, simply click the "Layout" tab on the bottom, and you'll be taken to a visual representation of your layout:
Like so:
There are some limitations for sure (e.g. text shadowing, for one, will not be depicted in this view), but it's a good way to get a general idea of how your layout is working.
Versions 2.x and higher of Android Studio render the XML in real-time in the Preview pane of the IDE and it even juxtaposes the XML and outline views side by side.