I understand this can be caused by spelling and grammatical errors and I have double checked this part of the code. My main is to have the image 'alien' in a specific position on the canvas. The error comes from this code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/spaceinvaders"
>
<ImageView
android:id="#+id/alien"
android:src="#drawable/alien"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
andriod:layout_marginTop="120dip"/>
</LinearLayout>
I believe it is caused by your last line.
andriod:layout_marginTop="120dip"/>
Related
I would like to implement the color picker library at https://github.com/attenzione/android-ColorPickerPreference:
To setup, in a dialog, the xml is added according to the instruction in website, and is as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<RelativeLayout
android:id="#+id/message_dialog"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/layout_round_corners_blue" >
<net.margaritov.preference.colorpicker.ColorPickerPreference // error line
android:layout_width="wrap_content"
android:layout_height="wrap_content"
holo:defaultValue="#color/pumpkin_orange"
holo:key="color1"
holo:summary="#string/color1_summary"
holo:title="#string/color1_title" />
</RelativeLayout>
</RelativeLayout>
Question:
The xml reports error error: Error parsing XML: unbound prefix at the above error line marked.
What is the problem for the above xml?
you have to change this <net.margaritov.preference.colorpicker.ColorPickerPreference to your package where you add this class like
<com.example.yourPackagewhereyouAddThisClass.ColorPickerPreference
like
net.margaritov.preference.colorpicker
change this above to your package Name where you add you ColorPickerPreference Class
As mentioned in the title, my autocomplete textview suggestion list is getting hidden when I have a mapview just below it. I have commented the mapview in the below code and checked and it shows the autocomplete list. What need to be done in order that the the list is shown on top of the mapview below it?
layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/background_color"
android:orientation="vertical" >
<com.test.CustomAutoCompleteTextView
android:id="#+id/atv_places"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:background="#drawable/candidate_white_bg"
android:hint="#string/str_atv_places"
android:textColorHint="#color/grey"
android:singleLine="true" />
<com.google.android.gms.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</com.google.android.gms.maps.MapView>
</LinearLayout>
Any help is much appreciated.
You could try using z-order(mAutocompleteTextView.bringToFront();, docs)
If doesn't work - try using same with RelativeLayout
Hi im just started programming and i just get this error message
"Multiple annotations found at this line:
- The markup in the document following the root element must be well-
formed."
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/jcea"
/>
</LinearLayout>
You're closing the LinearLayout element twice. Remove one of the closing tags, e.g.:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/jcea"
/>
Replace the /> with a >, or remove the /.
In xml, /> is another way of closing a tag if it does not have any data associated with it. For example, the following two statements are both valid and identical:
<tag></tag>
and
<tag/>
That being said, you should change your code snippet to either:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/jcea">
</LinearLayout>
or
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/jcea"/>
I have been following a book on Android "Beginning Android Application". I have been trying to figure out an application which shows images in a view. But unfortunately I could not run the application because of the following errors:
[2012-04-24 19:37:33 - Gallery] F:\eclipse workspace\Gallery\res\values
\attrs.xml:2:error: Found text "
[2012-04-24 19:37:33 - Gallery] ​​​​ " where item tag is expected
For convenience I am giving here the codes.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Bilai"
/>
<Gallery
android:id="#+id/gallery1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ImageView
android:id="#+id/image1"
android:layout_width="320px"
android:layout_height="250px"
android:scaleType="fitXY"
/>
</LinearLayout>
This application requires another xml file. It is named as attrs.xml under res/values.
attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="Gallery1" >
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
I think the problem lies within attrs.xml, but I dont know whats going on. And because of this the R.styleable also doesnt work either. Please help. Thanks in advance
I think you have some characters before each line in your attrs.xml due to a copy/past method.
Can you try to reformat your code by placing your text cursor at the beginning of each line and delete to return to previous line ?
i have been trying to create an xml file that integrates a relative layout within the a tabbed layout. Here is my code:
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
<RelativeLayout
android:id="#+id/simpleMode
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</LinearLayout>
</TabHost>
I am receiving a multitude of errors and i can't seem to find what my problem is:
My errors are Relative Layout must be followed by > or />
and
No recourse found that matches the given name at android:id="#+id/simpleMode
Any help would be appreciated Thank You Very Much!!
Please see you are missing " after android:id="#+id/simpleMode.So your xml file is giving error.Just put it and run
The best way to find these errors easily is to run the XML through an XML validator. The XML validator will tell you exactly whats wrong with your XML.
I generally use W3 Schools XML validator here: http://www.w3schools.com/xml/xml_validator.asp