0

Sony SmartEyeglass でカード テキストの変更を実装しようとしていますが、レイアウトに問題があります。SDKから高度なレイアウトサンプルを採用し、修正しました。

タイトルと本文テキストを表示するデフォルトの xml レイアウトがあります。'Title' と 'Body' をデフォルトの文字列として xml ファイルに入れ、'Updated' と 'Updated body text' としてタイトルと本文を更新しようとしました。ただし、結果には、デフォルトのレイアウト (「タイトル」と「本文」) と、それらの上に「更新された本文テキスト」というテキストが重なって表示されます。

タイトルが編集されていないのはなぜですか? また、本文が 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>
4

1 に答える 1