• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Difference between >, />, </______> ?

Muesum

Lurker
Hi!

can anyone explain the relationship and difference between these closing parentheses?

Examlpe

<Linearlayout

**something here** >
<textView
**smth here** />

</LinearLayout>

Why is there > + </> for linear layout?
Why linear layout has > on end, but text view has />? Whats the difference? what will happen if i mix them up?

many thanks in advance!
 
It's not for linear layout, it's xml syntax, it's how xml is written.

<something>
is the beginning of a list of "something".

<something />
is self-closed. It's an item.

<something>
<item 1 />
<item 2/>
</something>
is a list of "something".

<LinearLayout>
<something>
<item 1 />
<item 2/>
</something>
</LinearLayout>
means that the list of "something" is the linear layout.

Every < has to be closed by a />

If they're not in the same line, you have to name the close, so the parser knows what you're closing. In this case, LinearLayout was started on one line, there were other things, and it was closed on another line. Item 1 was closed on the line it was started on, so the close didn't have to be named.

Get a book on xml, or look for an online tutorial on xml, if you want to learn it.
 
thanks! made more sense.
well im actually following tutorial series on youtube. He never told the difference, and sometimes because he magnifies a part of code, i had those closing parentheses left out or written wrong. At least i think that this was the source of some errors i got, so i figured to clarify this.
 
Back
Top Bottom