XML layout is different once loaded - android

I've a layout with a 16 buttons, every button has an image and a textview under the image.
I've this buttons in a particular order,but once is loaded in the activity the order is not the last i've edited but remain the previous!
Why in the editor of eclipse is correct and on runtime is different?!?
Thanks!

Sometimes a clean and rebuild is enough to solve your problem. Also you will get a warning on your XML preview that you need to build your project if you changed any code in a custom view for it to draw it properly.

Uninstall previous app from your android device (if compiling from android device).
Then Go to Project->Clean . Then run your project .

First of all Uninstall the application from your device .
go to Project > Clean. then you can run your project again
it will be remove your error strong text

Related

layout refresh is not available in android studio 2.2

After updated to Android Studio 2.2, Refresh layout option not available. How to get this button?
After lot of search google may remove the refresh button in Android Studio 2.2
refer this - https://developer.android.com/studio/write/layout-editor.html
Incase your layout not get refreshed try the following solutions
Solution1 works for me when I use PercentRelativeLayout..
When first time my layout not refreshed.. after rebuild layout refreshed for me.
Solution 1:
Please rebuild your project (goto Build -> Rebuild project)
or
Solution 2:
Note: This is not proper answer.. Its just trick
Incase if your layout not get auto-refreshed try the following steps
just set the background to anyview
for ex:
android:background="#mipmap/ic_launcher"
and then rename drawable name with wrong value.. and save again.. you will get error..
after remove this line your layout may refreshed..

Unable to drag UI elements to Android layout Eclipse

I am having trouble getting Eclipse 4.2 to work with the latest Android SDK. When I try to drag any of the UI elements from the palette onto the Graphical Layout of the XML, or onto the outline view, nothing happens. Same is true when I try to drag existing elements in a relative layout. I am able to use the XML for the layout but not the designer.
I am also not able to close tabs using the x icon, I have to right click then go to close.
I have tried using Eclipse 3.7, same problem.
Thanks in advance for the help.
The emulator might be running. Try closing the emulator and drag ....it should work !
Hello I am assume that into your XML file, You can not see the graphical layout.
I have also face the same problem when I import the project from the workspace, that time simply close the project and again open the project.It works for me.
And for more Information see this LINK
Finally solved by re-downloading eclipse
Check your XML for warnings displayed as little yellow exclamation marks like this one:
Although my code was running fine this prevents any drag and drop.
Try cleaning the project and run it again. this worked for me.

No Graphical layout editor in Android

I imported an Android project in Eclipse. Somehow, the layout editor does not open automatically when I open a layout! After I open it, it gives me the 'Graphical Layout' tab but it is still an empty frame! The only difference I see from my previuos projects is that the top drop-down menu has an option called "Locale" while the older ones had "Any locale".
Please advise.
Restart eclipse. I always close eclipse when this error happens and restarting it after that and my problem got resolved.
Something similar happened to me today and I found that if I closed the window/tab and opened again a few times it fixed itself. It was annoying though. Also try going into the xml tab and edit something in there and go back to the Graphical Layout.
Something similar happened to me a few versions of ADT for eclipse ago.
EDIT
Ok it has just happened to me once again. What I did to resolve was to change the Android version to something else. It's the drop down box beside the Create... button. That made it reappear
I have the same problem, it goes away if I switch to XML view and make a single edit, and then save. Then switch back to graphical layout and the error is gone.
It wasn't working for me no matter what I did. But it started working again when I deleted a bunch of projects in my workspace. My theme for eclipse was also deleted when I did this too, I'm not sure why.

XML Problems with Eclipse / Android SDK

I'm fairly new to eclipse and android development, and I'm having what must be a pretty simple error to fix. I've done some development on my laptop and never encountered these errors. (I currently only have access to public computers, and have eclipse and the SDK installed on a USB drive.)
The first strange thing I noticed when editing the main layout was that there is no properties window to allow easy editing of various layouts and objects. (There was on my old computer) I have not been able to figure out how to get this window to appear.
So after adding one textView and modifying its properties by hand, I receive the following two errors when I attempt to run the program. (No code has even been added yet, just one textView)
http://i.stack.imgur.com/9VGT0.png (Link to screenshot of error, only have 6 rep)
All I've done is change the textView to have center gravity, fill_parent layout width, and a textSize of 22sp. I've tried googling the errors to figure out what I'm doing wrong but have been unsuccessful. Anybody encounter this before? Also, if anybody knows how to make the properties window appear it would be a great help.
Thanks in advance
When compiling Android stuff in Eclipse, you have to press the "Run" button with a .java file open, not with .xml file open. No idea why, but the glitch is there and you'll soon remember to avoid it.
To fix the current state, delete the 'main.out.xml' file (it was automatically created on compile). Then in the 'Problems' tab (the one on your screenshot), manually delete each problem it shows you. After that, press Run again with a .java file open and it should solve whatever is there now.
You get the properties window back from the "Show View" dialog, which is accessible from the "Window" -> "Show View" -> "Other ..." menu.
Once the dialog is open, look in the "General" folder for "Properties".
right click the .xml file and go to Open With... there are many ways to open it. I prefer the xml editor but there is also a layout editor available.
Your XML is not well-formed, e.g. mismatched elements, mismatched quotes, etc. Show your XML for more specific assistance.

Where is the Visual Editor for Eclipse with the ADT plugin

I thought ADT should come with a visual editor for building GUI : Easy way to build Android UI?
However, I just cannot find it. I was wondering where is the Visual Editor for Eclipse with the ADT plugin.
I can run HelloWorld application without problem. However, whenever I click on main.xml at the left navigation tree layout folder, here is what I get. What I wish to get is a WYSIWYG editor.
Select your main.xml file. At the bottom of eclipse you can see a Layout tab, click on it and eclipse will open the android gui editor.
As Paul Kearny previously noted, to resolve issue with seeing "Design" tab instead of "Graphical Layout" follow these 2 steps:
1) Delete project from the left of the screen, without deleting the source files
2) File -> Import -> Existing Projects into Workspace, browse and select your workspace folder and open your project
Graphical Layout problem fixed!
If you want to edit the layout visually, rather than through XML, click on the Layout tab at the bottom left of the main.xml window (in your screenshot, just above Problems).
Also note, there are issues with displaying some of the widgets. For example, the ListView does not render. So, my hint is to change ListView to just a View, then work out the details of the layout so you can get the colors, relative-ness, etc. Then switch it back to ListView. There is one other widget that I cannot recall off the top of my head ...
To resolve issue with seeing "Design" tab instead of "Layout" or "Graphic Layout", I had to:
1. Delete the project from Eclipse without deleting the source
2. Shut down and restart Eclipse
3. Import the project back in
You could probably skip step 2, but I did it just to make sure.
Hope this helps anyone else who has the same issue.
If your view is showing Design|Source for the .xml file right click on the main.xml and select open with - android common XML editor. Simple.
If it is happening to one particular xml, you can delete the file (make sure you copy the content first), create new xml and paste the content again.
I recommend that any serious Android developer stay far, far away from Eclipse/ADT Design View. This is a time-wasting tool that sorely lacks the attention it would need from Google to make it worth serious consideration. It doesn't render the views as a real device would. There is no way to bind dynamic data. Does it work with fragments (I think not)? For it to work properly and have useful features would weigh down Eclipse further and make it unacceptably slow. In my very humble opinion, the entire strategy for ADT's ui-design tools has failed.
Thus, the recommendation is: edit Android XML layout files by hand and use the only reliable testing mechanism you have for layouts: actual devices. You can always fallback on the emulator - but the emulator performs 50x - 100x slower than an actual device. I'm not exaggerating. Pick your poison!
new fix, took me forever to get this fixed, really simple....delete the xml file and undo the deletion (ctrl+z), double click and there you go. Hope this helps someone as it did me. No shut down required.
If you see "Design" tab instead of "Graphical layout", just close the project and open it again.

Categories

Resources