2014-10-21 2 views
0

У меня есть следующие элементы управления: ListView и Two TextView внутри строки.layout_toRightOf: типы строк не разрешены

Я пытаюсь сделать стойку «rowTextView» слева и «rowTextCount» рядом с ней справа.

Вот мой XML для строки:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#000000" 
    tools:context="com.k.l.MainActivity" > 

<com.k.l.MyTextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rowTextView" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="5dp" 
    android:textColor="#888" 
    android:textSize="28sp" > 
</com.k.l.MyTextView> 

<com.k.l.MyTextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rowTextCount" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="5dp" 
    android:textColor="#888" 
    android:layout_toRightOf="rowTextView" 
    android:text="666" 
    android:textSize="28sp" > 
</com.k.l.MyTextView> 

</RelativeLayout> 

Ошибка: типы строк не допускается (в 'layout_toRightOf' со значением 'rowTextView')

Спасибо!

ответ

2

ждем и id. Измените его на:

android:layout_toRightOf="@id/rowTextView" 

Here вы можете найти в документации

1
<com.k.l.MyTextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rowTextCount" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="5dp" 
    android:textColor="#888" 
    android:layout_toRightOf="@+id/rowTextView" 
    android:text="666" 
    android:textSize="28sp" > 
</com.k.l.MyTextView> 
Смежные вопросы