'<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/droid_background"
>
<TextView
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/hello"
android:textColor="#FFFFFF"
android:textStyle="bold"
>
<RelativeLayout>
<ToggleButton
android:id="@+id/togglebutton1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Audio"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
>
</RelativeLayout>
</TableLayout>'
Получение ошибки Разбор XML: не сформирован между открытием <ToggleButton>
и закрытием </RelativeLayout>
. Что я делаю не так?
вам не хватает закрывающих тегов или/на TextView & ToggleButton
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/droid_background" >
<TextView
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/hello"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content" >
<ToggleButton
android:id="@+id/togglebutton1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Audio"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" />
</LinearLayout>
</TableLayout>
У вас нет закрывающих тегов для <TextView>
и <ToggleButton>
.
Вам будет полезно потратить немного времени на чтение базовой структуры XML-документа. В частности, XML должен быть хорошо сформирован. Вот хороший учебник:
http://www.javacommerce.com/displaypage.jsp?name=wellform.sql&id=18238
Вы не закрыли тег ToggleButton и TextView. Обращайте внимание на это всегда. Это обычная ошибка использования
<ToggleButton />
вместо.
вы должны закрыть баллистический ToggleButton, есть два способа сделать это:
<ToggleButton......... > </ToggleButton>
ИЛИ <ToggleButton........./>
то же самое для TextView
, поэтому проверьте все свои взгляды при кодировании :)
С уважением
замените код переключения на это (т.е. закройте его) и добавьте закрытие для текстового представления() в зависимости от того, что вложено внутри текстового поля.
Предполагая, что вы не имеете в себе котировки, вам нужно закончить TextViews и Toggle Butotns.
Попробуйте посмотреть здесь: http://developer.android.com/guide/topics/ui/declaring-layout.html
Измените свой код на это:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/droid_background"
>
<TextView
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/hello"
android:textColor="#FFFFFF"
android:textStyle="bold"
/>
<RelativeLayout>
<ToggleButton
android:id="@+id/togglebutton1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Audio"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</TableLayout>
'<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/droid_background" >
<TextView
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/hello"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ToggleButton
android:id="@+id/togglebutton1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Audio"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</TableLayout>'
ваш относительный макет должен иметь свойства высоты и ширины
TableLayout
может использоваться как LayoutRoot (первое объявление). Я бы попробовал обернуть все это вLinearLayout
.