Eclipse give me a good experience in code assistence.But when it comes to animation xml files and i enter alt+/,it pop up nothing.So it make me very easy to type a wrong attribute name because of my poor english.can you give me a hand?
thanks.
Make sure that your animation xml file is location in anim folder not animation folder
I am not sure what you mean by "animation xml file" (the CEGUI ones? Android ones?), but, as explained in "eclipse editor, ex: xml editor, code assistance. how it works?", any xml file with auto-completion needs a DTD or Schema informtion.
Sometime, the DOCTYPE at the beginning of the xml file can prevent the auto-completion to work.
Related
we do app:lottie_rawRes="#raw/great" to fetch lottie file but how can we do it in java to fetch lottie file like that as of XML? I tired to do many things but could not solve that. how can I get that?
Setting up the animation from the xml file can be done in 2 ways:
by using app:lottie_fileName=”motorcycle.json”
or app:lottie_rawRes=”#raw/motorcycle”.
The code equivalent of the first is this:
av_from_code.setAnimation("motorcycle.json")
Note that your animaniton file must be in your assets folder.
I am learning Android and want to be able to add line comments to my XML so I can remind myself what things are doing.
Is there an accepted practice for this, or is it possible in Android Studio? I recall reading that comments in XML are hard, so I wanted to know if that was also considered true here.
As mentioned above you can comment in XML just like this:
<!-- Comment -->
But in android studio you can very easily toggle comment just by selecting what you want to comment and then pressing:
CTRL + /
This not only for XML but also for your java code for example.
It is indeed possible. I'm not sure if there is an accepted practice, but you can accomplish leaving a comment like this
<!-- comment goes here -->
Same as in all XML applications:
Just use <!-- ... --> to comment.
Comments in XML aren't too tough. You have to do it like this:
For example
<!-- This is a comment -->
Please don't hesitate to ask for anymore help. The above should work in android studio.
If you are using a Mac then command is command(button which looks like Windows start button ) + /
If you are on Windows then it is
Cntrl + /
Try and see if it works
In Android Studio DOLPHIN version I have tried using the
and the file does NOT like it. It produces errors when used.
I don't know about XML files much, but this AndroidManifest.xml file does not like this. Any other tips that might work? This file is error free before the comment line is added.
There are similar questions, but none address my specific issue.
I'm rather new to Android development and Eclipse but was able to follow the tutorials A OK.
In fact, I'm able to edit activity_main.xml from a tutorial, but now, in a test project I'm working on, I can't edit my new activity_main.xml (again, different project, same filename).
I created the file by right-clicking on the layout folder then selecting NEW > OTHER > Android XML Layout File. I was able to copy some of the other file so that my file now looks essentially like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
</LinearLayout>
When I type, the cursor moves around (looping through the text) but no characters appear on the screen. Again, in the other XML file I can edit with no problem.
I'm hoping that this is just some newbie problem.
I have had similar problems, though not this exact problem. Sometimes simply restarting Eclipse, or whatever editor you use, can help. Occasionally, Eclipse will not detect changes in your xml so you need to clean and rebuild the project. You can do this by
Winodow --> Project --> Clean...
and choose your project
I know there was an issue that I had which was similar with the editor jumping/replacing lines and such which I believe was fixed in a newer version of Eclipse. If I can find a source later I will edit
Clear all of text in layout activity_main.xml (in code view)
Drag and drop new LinearLayout in layout (in graphical view)
Go to Project -> Clean
I have an imageView in my main.xml file, that isn't setup with a source initially. I want to be able to dynamically change the image resource within the code. so lets so i have my imageView setup like this:
<ImageView
android:id="#+id/countryImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/CountryImageContent"/>
So i try to access within my code like this:
ImageView img = (ImageView) findViewById(R.id.countryImage);
The problem is here. Eclipse is giving me an error saying that "countryImage cannot be resolved or is not a field". A quick peek into my R.java file is showing me that the imageView isn't actually in there. Why is this happening? Thanks.
look into your drawable and layout if there is any error
if not try cleaning your project
Go to Project > clean > select your project
if not then look into your imports for
your.packagename.R remove it
Project -> Clean.
That is the only solution to this.
Also make sure that among your import statements, you do not have this : import android.R
Check this link for a detailed procedure.
Note : I am assuming that there are no errors in your layout and drawable files, as errors in them may also lead to this problem.
make sure all resource files have only lowercase letters , numbers and the underscore character ("_") .
only if there are no errors in creating the R file (in the "gen" folder) , you can use the id of it.
I think it is the problem to giving the name of #string
Please Remove all UpperCase Character from #string/CountryImageContent and replace it with small character.
R.java file doesn't support any Uppercase character. It gives the same error when you declare the file name of any resources Like :- Image, XML, #string, etc...
Just rename CountryImageContent with country_image_content. it will work perfect.
Another option to try in this case is: File --> Invalidate Caches / Restart...
When I am editing a layout file is there a way to get eclipse to autocomplete my strings references from strings.xml.
For example if I have a layout node like this...
<PreferenceCategory android:title="#string/settings_category_stay_intouch_title">
It would be great if I could type the #string/settings_ part and then use alt+space like I can when I referencing the R.string in a source file.
Right now I just get "No XML Template Proposal"
Any tips for configuration or plugins would be appreciated. I use strings.xml extensively and I have a ton of layout files so flipping back and forth between strings.xml and my layouts as I work on them is a bummer.
Well it should work. Try using on windows CTL+space.
I tested with latest ADT 16.