Я пытаюсь реализовать изменение текста карты на Sony SmartEyeglass, но у меня возникают проблемы с макетами. Я взял расширенный образец макета из SDK и изменил его.
У меня есть макет xml по умолчанию, который отображает заголовок и основной текст. Я поместил «Заголовок» и «Тело» в качестве строк по умолчанию в файле xml и попытался обновить заголовок и тело как «Обновлено» и «Обновлено основной текст». Однако результат показывает мне макет по умолчанию (с «Заголовок» и «Тело») и текст «Обновленный основной текст», перекрывающийся поверх них.
Почему заголовок не редактируется и почему основной текст находится поверх xml TextView?
Вот соответствующий код:
@Override
public void onResume() {
showingDetail = false;
ControlListItem item = createControlListItem(namePosition);
showLayout(item.dataXmlLayout, null);
sendListCount(item.layoutReference, quotedPeople.size());
sendListPosition(item.layoutReference, namePosition);
//utils.sendTextViewLayoutId(R.id.names_body);
sendListItem(item);
}
private ControlListItem createControlListItem(final int position) {
Log.d(Constants.LOG_TAG, "position = " + position);
ControlListItem item = new ControlListItem();
item.layoutReference = R.id.names_gallery;
item.dataXmlLayout = R.layout.smarteyeglass_quotes_names_gallery;
item.listItemId = position;
item.listItemPosition = position;
List<Bundle> list = new ArrayList<Bundle>();
// Header data
Bundle headerBundle = new Bundle();
headerBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.names_title);
headerBundle.putString(Control.Intents.EXTRA_TEXT, "Updated");
list.add(headerBundle);
// Body data
Bundle bodyBundle = new Bundle();
bodyBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.names_body);
bodyBundle.putString(Control.Intents.EXTRA_TEXT, "Updated body title");
list.add(bodyBundle);
item.layoutData = list.toArray(new Bundle[list.size()]);
return item;
}
Вот файл макета xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/smarteyeglass_control_width"
android:layout_height="@dimen/smarteyeglass_control_height"
tools:ignore="PxUsage,UselessParent,HardcodedText" >
<TextView
android:id="@+id/names_title"
android:layout_width="400px"
android:layout_height="30px"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginTop="5px"
android:paddingLeft="6px"
android:background="@android:color/black"
android:text="Title"
android:textColor="@android:color/white"
android:textSize="@dimen/smarteyeglass_text_size_normal" />
<View
android:id="@+id/names_divider"
android:layout_width="400px"
android:layout_height="2px"
android:layout_alignParentLeft="true"
android:layout_below="@+id/names_title"
android:background="@android:color/white" />
<TextView
android:id="@+id/names_body"
android:layout_width="400px"
android:layout_height="78px"
android:layout_marginTop="5px"
android:layout_marginLeft="10px"
android:layout_alignParentLeft="true"
android:layout_below="@+id/names_divider"
android:textColor="@android:color/white"
android:textSize="@dimen/smarteyeglass_text_size_small"
android:text="Body" />
<Gallery
android:id="@+id/names_gallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</Gallery>
</RelativeLayout>