Lynx cannot render "Button" tag - android

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

Related

Displaying a TextView immediately after another

I am a first time developer for Android, so you can say I've been learning as I was developing. For most of my code that doesn't have to do with the XML layout, I had no problem patching my rookie mistakes. With that said, my rookie mistakes has caught up to me in regards to two TextViews when I initially designed them with the GUI interface designer (my major rookie mistake).
My display_city tv and display_today_date tv seem to have a symbiotic relationship with each other. Removal of either one would crash the app. They seem so dependent on each other that changing each other's positioning is impossible (at least from the myriad of things I have tried such as setting layout margins).
<TextView
android:id="#+id/display_city"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dip"
android:layout_above="#+id/display_today_date"
android:layout_below="#+id/get_data"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/display_today_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/display_pollen_type"/>
My question is - how do I simply position display_today_date immediately after my display_city? When I first started this Android app, I relied a lot on the GUI builder. That was my first rookie mistake, which resulted in this symbiotic relationship I explained.
Currently this is what my app looks like:
I have tried changing display_today_date's layout to android:layout_below="#+id/display_city. This results in a crash. I checked logcat, but it did not give me relevant information to the reason of the crash within the XML file.
P.S. get_data is my TextEdit box.
You already have the city to show above the date with the line android:layout_above="#+id/display_today_date". You can't have 2 views in a relative layout each reference the other, or it won't be able to figure out what to do. If you don't want to put the city above the date, delete that line then add the code to place it where you want.
You could use a LinearLayout with the orientation set to horizontal. That way there is no reference to another view. So if you delete one the other one won't cause the app to crash.

Long text goes to next line on ICS, but not on GB and below

The first time I noticed this was with AlertDialogs putting the entire message on the first line, even when I specified a new line("\n"). On ICS it displays the correct way, but for the life of me, I couldn't get it to work on GB.
Recently I've run into it again. I don't see any reason for it working fine on ICS but not GB and below.
EXAMPLE Project
Heres an example project with a textview, alertdialog, and two standard textviews.
https://github.com/T3hh4xx0r/Text-Example
EDIT
Heres the original question I asked. Seems the problem is more than I originally noticed though.
Android AlertDialog not displaying entire setMessage on certain devices
/EDIT
Here are visual examples of what I mean.
Even specifically setting multiple lines for the textView, the text is still one line, but with extra blank lines below.
Here is the layout that the alertdialog is using to create your view:
<!--
This layout file is used by the AlertDialog when displaying a list of items.
This layout file is inflated and used as the TextView to display individual
items.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/primary_text_light_disable_only"
android:gravity="center_vertical"
android:paddingLeft="14dip"
android:paddingRight="15dip"
android:ellipsize="marquee"
/>
As you can see the ellipsize is set to marquee, so I don't believe it was ever written with the intention to allow multilines.
There is a bug open at the moment that ellipse dots are never shown: http://code.google.com/p/android/issues/detail?id=10554
Therefore it is acting correctly.
If you want it to go onto multiple lines, create your own layout file and pass that to your dialog, that way you have more control anyway.

stop xml entity from producing square

i have the following in my xml file and it gives me a square ⃠
<?xml version="1.0" encoding="utf-8"?>
...
<Button android:text="&#8416" 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

<include> tag isn't accurately displaying it's content

I have a layout menu which contains this:
<RelativeLayout android:id="#+id/computersMenu"
android:layout_width="50dp"
android:layout_height="50dp">
<include layout="#layout/component_add_button"
android:id="#+id/imagebutton_add_client"/>
</RelativeLayout>
component_add_button.xml:
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/ic_menu_add"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="center"/>
Looking at the preview (EDIT: I mean the "Graphical Layout" tab of the xml editor in eclipse which uses the same rendering engine as all devices AFAIK) of component_add_button.xml you can see the image. Great. On the page which is including it it isn't displaying (although it does give you a selectable space where the image should be).
This seems like a really simple example that "should just work". The include tag has always seemed really flaky to me - I'm wondering if I'm missing something in terms of how it actually works...?
As your answer states, the eclipse preview does not display included layouts.
The simplest way to avoid doubt or mistakes in markup when "including" layout's is to design in the original layout then right click the view you wish to extract and select Extract include... from the menu
On a device this functionality worked fine. This seems like a bug in the "Graphical Layout" tab of the layout xml editor shipped with android-sdk.

My Android "Hello World" app doesn't say "Hello"

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.

Categories

Resources