I have Layout xml file and when i edit it
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/image1"
android:text="llllllllllllllllllll"
android:textColor="#android:color/black" />
But it change like,
its happens when i edit xml file.and after closing xml file and i need to re-open and re-open.is there any solution ?
i already restart my eclipse but can't solve issue.And restart eclipse is not working.is
there any solution for that ?
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421
It is a problem with Eclipse editor which I also face often when the change is done by dragging and dropping in Graphical Layout or so. The solution I follow is to close the xml and reopen again.
This problem happens when you edit your relative layout xml file. To avoid this you can escape this component or close xml file then reopen it.
It's a bug of Eclipse
you can find here is a bug report
Also facing same problem. Sometimes need to restart eclipse also.
Related
so i've learning a little about android studio recently, but every video i see, when they modify something from the "properties" window i have issues because mine says "atributes" and misses a lot of properties.
Does anyone know how to make it appear?
I have already tried a lot of stuff, like Window > restore default layout, also deleting the workspace, reinstalling android studio but i cant make it work.
I'll leave an imagen to show how i see it
https://gyazo.com/0cd32a07cefde36bb3fbbdaff5a9dff2
But every video i see has this
https://gyazo.com/300f41730bf495d8e0db05cb55d7f8d1
look at how many properties they have vs what i have, i already pressed the "view all atributtes" button
Thanks!
In Android studio 3.4.1 View -> Enter presentation mode then "attributes windows shows"
To see the "attributes" table, you only need to check the "gear" icon on that window and select "All attributes table" instead of "XML attribute table".
For more details you can check
https://developer.android.com/studio/write/layout-editor
I went into activity_main.xml, manually changed the text size of a button:
<TextView
android:id="#+id/text_view_p1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Player 1: 0"
android:textSize="30sp" />
Then I changed it back to the original size. Attributes window magically appeared again. Before I tried that, nothing else worked
My issue is similar to this but Android Studio doesn't tell me anything about a rendering issue or compiler/build errors(I was able to build fine).
Here is what I am seeing(this is a new project)
And the contents of content_main.xml
After reading on different rendering issue threads, I I've tried rebuilding, cleaning, invalidate caches/restart and even starting a new project to see if the layout preview was working(Still empty)
I also played around with different sdk versions(20,19) to see if the layout preview was working but all I got was this quirky issue that I don't think would cause the layout preview to not work.
Does anyone know what my problem is here? I didn't mess around with my initial Gradle files and remove any support library dependencies. Another solution I had in mind was reinstalling Android Studio but that's last resort.
Just check your sdk valid version like example.
Try putting your TextView element into an empty FrameLayout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/my_groups" />
</FrameLayout>
This code above should be put inside your RelativeLayout. Hope it helps.
When I do changes to a layout resource file it's not updated/reflected when the apk file is buildt and installed from Android Studio 2.0 (Preview 3b).
Example:
I had a EditText and I added a TextInputLayout like this:
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<EditText
android:id="#+id/edit_text_new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/hint_your_new_password"
android:inputType="textPassword"
android:saveEnabled="false" />
</android.support.design.widget.TextInputLayout>
The result after updating the app is the same as before I added the TextInputLayout, just the EditText without TextInputLayout.
What I've tried:
Build/Clean Project
Build/Rebuild Project
File/Invalidate Caches / Restart..
Uninstall app first
Turn off Instant Run
I suspect this is probably a bug with the Preview 3b version of Android Studio 2.0 causing this. Any ideas? Maybe it's just a settings/configuration?
Temporary solution:
If you make a copy of the layout file and inflate it instead. Then the changes are updated in the app? But this is not ideally the best solution!
Also make sure you make the changes in the layout-v<target-api> folder if you have set specific layout for specific api level. For example layout-v23 in mine case.
This issue is typically caused by only updating the xml file in one layout folder and not the other folders containing the file's compatibility variants as well. For example, only editing the xml file in the layout system folder and not the layout-v14 folder too will cause this issue.
The fix: update the instance of the layout xml file not only in your layout folder, but the instances in all other layout folders too (layout-v14, layout v-21, etc.)
I wasn't able to reproduce this issue. I tried the same layout changes with Preview 3b and the changes showed up in the emulator fine. I simply hit the run button again.
Was this working for you in a previous version of Android Studio?
After adding a new Activity to my project I get following error while compiling the layout
Gradle: Error parsing XML: not well-formed (invalid token)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_password"
android:text="<password>"/>
</LinearLayout>
"http://schemas.android.com/apk/res/android" is marked red and hovering pops following message up
URI is not registered ( Setting | Project Settings | Schemas and DTDs )
My Settings>Project Settings>Schemas and DTDs look like that:
I already found some similar questions around here but nothing helped me to solve this issue. I hope someone has an idea... :)
I was having a similar issue. However, the comments did not assist me in the solution to this issue. This answer from this question actually solved my problem.
Summary:
Go to "File > Project Structure > Modules", click "add" and then click "android" and "apply/ok". That should solve anyone having a similar problem but the comments for this question are not helping you.
For me, the problem occured when I created my own subfolder for old code.
Specifically, Android Studio threw an error for all layout files that weren't in the default folder ../res/drawable/, but instead placed in my own subfolder ../res/drawable/backup.
I got the same error for a long time and none of the answers I found online really helped me, or probably I wasn't looking the right way. At the end what I found out was the way I named the directory. So, I was trying to make the landscape layout for my app and named it layout_land. That kept showing me the URI is not registered error. I just had to change the directory name to layout-land.
Summary: No underscores in directory names!
My issue was creating new resource directory for some animation work. The files were .xml and I chose file type as "xml". I got this problem. Changing the file type to "values" and the problem went away. No idea why, could someone explain this to me? I'm using Android Studio on an iMac.
GO to settings >Language&Framework >Schemas&DTD
here add Uri used in your code.
Some special characters not allowed here.
Directly to assign text then with warning
android:text="value"
#string file from get then avoid warning
android:text="#string/hello"
res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello!</string>
</resources>
For me this problem was gone when I have made following changes to my project structure on Android Studio.
file->project structure ->SDK Location -> enable check mark for "Use embedded JDK (recommended).
Hope this will help someone.
First thing is go to the project folder in the Android studio and check for any folders which are created by you. It will show this error if you have created any folder on your own.
I received error in my xml file. "Incorrect line ending: found carriage return (\r) without corresponding newline (\n).
<Button
android:id="#+id/btn_login"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/et_un"
android:layout_marginBottom="15dp"
android:layout_marginRight="22dp"
android:text="Login"
android:textColor="#AA0000"
android:textSize="10pt" />
How to solve it. can anyone help
Using Eclipse on Windows?
Open layout file
Ctrl+Shift+F (Command+Shift+F in MacOSX)
Save the layout file and close it.
Delete any .out files the builder might have created.
Clean project.
It looks like stupid thing, But It worked for me
select all (ctrl+a)
cut (ctrl+x )
Paste it again (ctrl+v)
Save it (ctrl+s)
It really worked for me.
It's easier than other answers:
Ctrl + 1 -> Fix lines
;)
Yesterday, I got this very same error message.
My fix is by simply removing every newline after
/>
So, if you have
<Button
/>
<Button
/>
change it into
<Button
/>
<Button
/>
Might not be the best solution.
If you happen to get this annoying error from time to time when you open an android activity xml file just press ctrl+shift+f to reformat your text and you’re good to go!
To fix this in one of my layout XML files, I did the following from within ADT:
right-click on the file in the Package Explorer
Pick Open With -> Text Editor
Now the offending line gets highlighted with a big red X.
I then deleted the line endings (combining the two lines) and then hit "return" to add it back in. In some cases I found that didn't quite work so I copied a similar line that didn't have the issue, and pasted it over top of the offending line (highlight the bad line, then paste). Sometimes it seemed that the real issue was with the line before or after it.
Then after saving it would show up the next bad line, so lather-rinse-repeat until it's all done.
When all done, use right-click, Open With -> Android Common XML Editor to get back to the visual design view.
(ADT v21.0.1, on Mac OSX Lion)
Close the xml file in the Eclipse
open it in text editor (notepad or notepad++ and so forth..)
save it.
open it back in the eclipse
In menu->Project->clean project.
Just clean the project. In Eclipse go in project menu:
Project-> Clean
It will resolve the problem.
Cut your whole code, save the xml, paste the code again in the file and save. It also solves at times. Though not a standard way, but works.
clean the project Project -> clean
worked for me
First refresh the project then clean (Ctrl+shift+F).
This solves the problem for me.
open layout file
if any layout is freezed that freezed layout delete
3.ctrl + A
4.ctrl + shift + f
save
it will work