i have the following in my xml file and it gives me a square ⃠
<?xml version="1.0" encoding="utf-8"?>
...
<Button android:text="⃠" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
...
the character is the "no symbol"/prohibited symbol but it shows up like a square...other symbols show up fine like euro €.
question is how do i get the symbol to show up and if i cant, how can i know what symbols will and wont work....is there a master list somewhere
Ok so due to various reasons it won't show up and there are other posts on this.
Why not use a left drawable in the image by:
android:drawableLeft="#drawable/myicon"
Same result and you don't have to worry about character encoding and fonts.
Sometimes it depends on the Font you are using. I had a link to look that up. I'll get back here as soon as I find it.
Update:
Here you go - http://www.fileformat.info/info/unicode/font/index.htm
Related
For reasons unfathomable to me, sometimes I edit an xml file (such as res\layout\main.xml) and Eclipse stops recognizing it. I get errors like "Bad XML block: header size 93 or total size 0 is larger than data size 0".
If I delete the contents and retype the xml file everything works fine.
Any ideas what's going on?
Try out both this things ,this can be help you to resolve the problem:
I just ran into the same error message. In my case, the XML was referencing a missing icon file in the drawables folder.
or
A Project->Clean should take care of this.
See this problems usually comes because of menu -
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="#+id/save_tea" android:title="#string/save_tea_label" />
</menu>
Better if you are not using menu so remove it otherwise give the proper string information there.
Thanks
This is strange, yet I see it all the time as I have lots of reasons to display just a simple question mark in this app.
When editing with the Eclipse graphical layout editor, everything is fine...until I tell a TextEdit or a Button to display just a question mark. Here's my code:
<?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:orientation="vertical"
>
<TextView
android:id="#+id/test_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/question_mark" />
</LinearLayout>
And the string is defined in res/values/strings.xml. The relevant line is:
<string name="question_mark">\u003f</string>
The error message I get is:
Missing styles. Is the correct theme chosen for this layout? Use the
Theme combo box above the layout to choose a different layout, or fix
the theme style references.
Couldn't find theme resource for the current theme
Change the text, and the error message goes away.
You can see that in my struggles, I'm even trying to use the unicode version of a question mark. And yes, \? doesn't work either.
Note that this only happens when the graphical layout editor is set to API 7 or greater.
Now the graphical layout editor displays the question mark properly, and the emulator and my phone display the question mark without any problems. I'm just annoyed with the error message taking up 1/4 of my screen for all my layouts (and obscuring other error messages that may crop up).
Any suggestions?
First, test this again on the ADT 21 release that shipped today.
If the problem continues, create a sample project that demonstrates the issue, and post it along with step-by-step instructions on the Android issue tracker.
Well, this is a really crappy hack, but it kind of works--if you stand on your head!
You can use the unicode \u00bf as in
<TextView
android:id="#+id/test_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\u00bf" />
It's not a normal question mark, but it's close enough for a hack and gets that annoying error message out of your hair. And it might even increase the humor quotient of your app!
But PLEASE, if anyone out there has a real fix, post it!
Wow, I entered a bug report...[time marches on]...finally, I get a few emails as the Google team starts to look at it.
Today, I received some good news. It looks like the bug has been fixed (and they found a few related bugs, which have been fixed as well). The fix will be in the next release, Version 21.1 Preview 2. You can read the official details here.
Looking forward to it!
I am checking a tutorial with Lnyx and I bumped into a strange problem.
I have written a couple of tutorials for myself, all have xml and java codes copied from Eclipse. My first problem is that Lnyx has a problem with xml code, for example it can see
android:id="#+id/btn_oneshot"
but it cannot see
<Button android:id="#+id/btn_oneshot"
meaning whole blocks are invisible, like
<Button android:id="#+id/btn_oneshot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="Start One Shot Alarm" />
I need to use "& lt;" instead of "<" because I am using a SyntaxHighlighter. If I used "<" (but I can't)
Lynx would display
[BUTTON] main.xml:
It looks like this is the reason that most of my page code is displayed in huge gray boxes by Lynx, instead of simple text. I checked some of my tutorials and it turned out that those who don't have a "& lt;Button" in xml are working fine, while those who has "& lt;Button" in xml aren't, meaning I can have a & lt;RatingBar or & lt;TextView in the code without any problems.
This is the print screen of Lnyx showing NO xml:
When I change the "& lt;Button" in XML code to "& lt;Buttons", the xml is still invisible, but the gray block is now missing:
As a conclusion:
1) The xml code is never visible
2) The rest of the code is in gray boxes (with no selectable text) when I am using "& lt;Button" in any xml code.
I am not sure about this, but as far as I know, what Lynx cannot see the search spiders cannot see, and this goes for the gray blocks as well. Or Lynx renders Button badly and the content is still visible for spiders. What do you think?
I checked in Chrome, IE9 and Firefox 14.0.1
First of all, I know there are thousens of post asking the same, but after few days looking for a valid answer and try everything I'm still having the same problem...
So let's expose my situation:
I'm using ABS + google maps, so my map view xml is the following:
<?xml version="1.0" encoding="utf-8"?>
<com.actionbarsherlock.internal.view.menu.ActionMenuItemView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ViewContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0PGmnrCR70lothfjc_sFGTdFtESQPOksYKQWYpw"
android:clickable="true" />
</com.actionbarsherlock.internal.view.menu.ActionMenuItemView>
Few days ago everything was good, I was able to do my stuff in the app and everything. But suddenly I just made a little change, insert a framelayout to display more options in the screen. I tried to go back but was impossible...
I'm really deseparated, what can I do? maybe I can create a new project and paste all my code, but not really sure if it's going to work...
Any suggestions?
BTW my error code is this one
Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
Failed to find style 'mapViewStyle' in current theme
java.lang.NullPointerException
Exception details are logged in Window > Show View > Error Log
Thank you for your time!
I finally solve the problem, the error in the screen is still there, but just like a warining and when I execute the app same to work fine.
The only think I made, is change the specific layout of ABS and put a frame layout.
I created a Hello World application, and the system generated most of the Android language below. When running the app without the System.out statement, there is no "Hello" displayed in the emulator. Then, using the Eclipse tutorial, I read that I can add the System.out.println statement to main. Again the app runs, but there is no output.
What am I not understanding here?
<?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="#string/hello"
System.out.println =" Hello world!"
/>
</LinearLayout>
I had this same problem, turns out all I had to do was be more patient.
The initial load time of the AVD seems like FOREVER... and in Eclipse before it actually looks like the device is booting up it just says "ANDROID_" against a fully black screen for quite a while. I thought it wasn't loading my text "Hello, Android" correctly, but it was actually just a load screen and I didn't wait long enough. (Yes, I now feel like a moron and a noob.)
If you're following along with the Android Developers Hello World Tutorial, and it doesn't seem like it's working, if you've never loaded the AVD before... maybe just wait longer?
Beginners' questions are fine, but boy, this really is a beginner question :) As for your problem, it can be a few things. What's probably happened is that you've adapted the basic "Hello, Android" tutorial which defines the TextViews in code, to make it display using an XML file. However, when you did that, you didn't change the code to use that XML file, and instead it's trying to display your old TextView. Also, "System.out.println="hello world!" won't do anything when in your XML file - you need to put statements like that in the code itself. In fact, offhand I can't remember if System.out.... even does anything in Android - debugging lines should be issued using Log.d("some title", "your message"), as that outputs to the Android specific logging device.
Anyway, it'd be easier to help solve your problem if you showed a bit more of your code. Try to make sure it's formatted properly, e.g. indenting code lines by four spaces. You can preview your post before you submit your edited version in the lower window to make sure it looks right.
Try this.
Hardcoded in [your_layout].xml
...
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Hello world" />
or this
Use reference in [your_layout].xml
...
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#strings/hello" />
In res/values/strings.xml
<resources>
<string name="hello">Hello world</string>
</resources>
That should help you get started a bit. A few thing to remember, System.out.println doesn't do a thing in Android, especially in XML file.
When addressing text with "#string/hello", it means that the application will look for string name "hello" inside strings.xml.
Anyway, you should try Android tutorial to get start.
One thing is for sure, putting println in your layout resource file won't do anything. This code(if it may be called so) is NOT executed. This is just definition of view. If at all, this statement should be called from your Activity class implementation(the java file) to be executed.