Android Studio 2.2 Losing Constraints? - android

So I have been trying to create a pretty basic calculator app.
I converted my RelativeLayout to a ConstraintLayout and started creating constraints.
After some time I noticed that while creating new constraints, the older ones get deleted.
Why is this happening?
I'm pretty new to Android development so I'm just trying to learn Android, my apologies if this is a low quality question.
Hoping to see some answer regarding this happening. I did some research on Google & YouTube and StackExchange, I'm sure I did everything correctly, just the constraints themself started disappearing after some time.

That could happen because constrain layout is still in beta. This will come with a lot of bug like these for instance. It could happen that it deleted all the constrains or maybe u accidentally pressed the 'clear all constrains' button in android studio.
You can check if constrains are still there by looking in to the text tab in edition to the design tab. And look for
app:layout_constraintRight_toRightOf="parent"
or any other variaty.
Since the constraint layout is still in beta. I would recommend just using the other layouts of android (Linear, grid, relative etc.).

Related

How to position controls in Android?

I am trying to create the UI but I'm having a lot of difficulty just placing controls where I want them to appear on the main screen. For example I want to add a few ImageButtons but they just seem to snap to one corner and I can't seem to add more than one.
Do I need to use a layout or something? Can't I just drag and drop and move the controls around where I want?
I suggest you start by reading a few of the developer tools out there. http://developer.android.com/guide/topics/ui/declaring-layout.html This guide will help you get your feet wet with how to properly layout a screen in Android. There are also a bunch of other great guides on there to help with other aspects of the UI. Even though you use C# in Xamarin Studio, the UI portion is native Android so the guides should still be relevant.
try to use relative layout , its kind of easy for visual studio developer and others too.
details here : http://developer.android.com/guide/topics/ui/layout/relative.html

Is it possible to preview the layout of an AppWidget in Eclipse?

I'm developing quite a few homescreen widgets and currently I have to install them on my emulator or my phone in order to preview the layout.
Is it possible to preview the layout in Eclipse? When I open the XML of my layout in the preview mode, it displays it as it it were an activity and therefore the scaling is entirely wrong.
You can use jimu as a plugin into Eclipse to achieve it. Jimu is a drag & drop style App creation tool for Android. That's the most suitable tool to allow you achieve what you have in mind to get WYSIWYG, as it will enable you to have live previews of Android layouts. You have also the option to use it with Eclipse, or with Android Studio or any other editor of your choice.
To avoid the need to compile-install-run, jimu Mirror gives you live previews of your app that update as you code.
As you can image, the most positive fact about Jimu is that it speeds up Apps development times.
Alternatively, you can use IntelliJ IDEA. IntelliJ IDEA also allows you UI layouts preview.
Thus allowing you achieve WYSIWYG. And equally IntelliJ IDEA gives you the option to integrate it with Eclipse. Of course, alternatively you may decide to simply completely to move to Intellij IDEA. It is available in a commercial edition as well as in a free open source community edition.
IntelliJ IDEA UI designer allows you to build application UI by dragging widgets from its side palette. In version 13 you can simultaneously preview the UI you’re creating on multiple devices, by just selecting Preview All Screen Sizes from the device drop-down. Preview displays all changes made through the UI designer or XML editor in real time.
Such tools for GUI implementation from Jimu and IntelliJ IDEA remembers a little bit Qt Designer, which is available also for Android. In fact, any approach that properly works, allowing interactive Android UI quick development, is a greatly welcome valuable tool for developers that should be well used to improve productivity.
At the top of the view in Eclipse switch to the Holo Panel theme. If you need your own theme attributes then create tour own theme override that parent's to this. Then you could choose that in the editor.
it displays it as it it were an activity and therefore the scaling is entirely wrong.
If it displays as an Activity, then create a dummy Activity that mimics the home screen. Then use a theme, or use an include tag to include the layout from your widget into the cell(s) of that larger dummy home screen.
This solution isn't ideal, but it should be able to give you a better approximation (if what you're looking for is just to tweak the layout of your widget).

Android editor Using Eclipse Link XML views to edit code and view graphic?

hi I'm using Eclipse at the moment, and I'm not sure if there is a plug in for it or a better piece of software I can use. It seems fine for the Java side The problem I have is with XML editing, the line up of the characters is very inconsistent and when editing my layouts, I work with a graphic view open and a code view open, but the two are not linked, so if I double click on an element it switches from graphic view to code view in that pane. it would be awesome if I could link the two open panes?
Please see the screen shot for my desired outcome.
I understand that this question could be seen as discussion based, but I am seriously just looking for a solution here. The example I show is very simple, but some of the xml files turn out quite large and complex, and it is becoming more important to me to find a solution for this.
You can use DroidDraw for ui designing. Although it is a bit buggy, but at-least you dont need to edit raw xml files if you use this.
I am now using the Android eclipse Juno development kit, and while I still dont have dual window available, the double click select is working. there is also an Outline pane which shows the layout, although annoyingly this doesn't show comments very well.

Eclipse - Show layout guides (lines) in the graphical layout for Android views

I am following a tutorial on Android Development, their video shows "layout lines" in the graphical layout. Such as when you place a LinearLayout you can see a light line around it so that it is obvious on screen.
The tutorial shows a button alongside the Zoom buttons above the editor that turns these lines on and off. However I do not have this button in Eclipse (latest version for java devs), I have googled and googled but can not find how to turn this on.
Any ideas?
I have had my question answered on another site, so I will provide the answer here also for anyone who stumbles across this page.
It seems that the feature I was seeking has actually been removed from the more recent (v16 and v17) copies of the ADT. I do not know why as it is actually a useful feature, but ours is not to reason why!
Thank you to those who looked at this question.
It is a functionality of the newer ADTs. Upgrade your Adt to the latest one and you would start seeing this feature.

Eclipse updates ruins Android XML layout editing

I recently updated my eclipse installation with which I develop my Android apps.
Soon I found my layout files have lost the up and down arrows associated with each VIEW and LAYOUT which helps to organize my layouts.
I don't know whatelse the update, if anything, has messed up but I wonder and would appreciate any information on how to fix this issue so I can get my developments back on track, please.
Thanks
Unfortunately this is not a bug: they have been officially removed.
The new editor in 8.x might look the same, but it's completely
different underneath and we have added the +/- features back.
the "-" button should be replaced by delete anyway. You can right
click and choose delete or simply hit delete on your keyboard.
The "+" option is indeed replaced by drag and drop. We've improved
drag and drop significantly (and still improving it for the next
version), and should be good enough that using "+" isn't needed.
In some cases too, "+" isn't enough, you need more information to know
where the item will be placed (like when dropping into a
relativeLayout).
(same thing with the up/down arrows)
(source)

Categories

Resources