0

我正在尝试索尼智能手表 2 的索尼附加 SDK 2.0。我将开发一些 Messageviewer。就像现有的 gmail 应用程序一样。它应该显示一个带有消息(简单文本、主题)的列表,并且通过选择任何项目应该显示带有标题和文本的内容查看器。

我创建了示例项目“SampleAdvancedControlExtension”,这几乎就是我想要的。我尝试使用以下布局创建一个新的“ContentView”控件。问题是,文本不可滚动,我看不到任何使文本可滚动的可能性。如果我正确理解 EXTRA_DATA_XML_LAYOUT,则不支持 ScrollView。但不知何故,GMail 应用程序可以滚动电子邮件的内容。他们怎么能这样做?

感谢您的任何建议

<?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/smart_watch_2_control_width"
    android:layout_height="@dimen/smart_watch_2_control_height"
    tools:ignore="PxUsage,UselessParent,HardcodedText" >

    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="28px"
        android:layout_alignParentTop="true"
        android:background="@android:color/black" >

        <TextView
            android:id="@+id/header_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:paddingLeft="6px"
            android:text="Это заголовок"
            android:textColor="@android:color/white"
            android:textSize="@dimen/smart_watch_2_text_size_medium"
            android:textStyle="bold" />
    </RelativeLayout>

    <View
        android:id="@+id/divider"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/header"
        android:background="@android:color/white" />

    <RelativeLayout
        android:id="@+id/content"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/divider"
        android:background="@android:color/black" >

        <TextView
            android:id="@+id/content_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:maxLines="5"
            android:paddingLeft="6px"
            android:text="Тут будет текст"
            android:textColor="@android:color/white"
            android:textSize="@dimen/smart_watch_2_text_size_medium"
            android:textStyle="bold" />
    </RelativeLayout>  


</RelativeLayout>
4

3 回答 3

0

我通过将其呈现为位图然后在列表中提供位图块来制作可滚动文本:http: //damianblog.com/2014/01/12/sw2-scrollable-text/

于 2014-01-12T14:21:00.067 回答
0

您是否尝试过设置 android:lines="5" 和 android:singleLine="false"?

http://developer.sonymobile.com/reference/sony-addon-sdk/com/sonyericsson/extras/liveware/aef/control/Control.Intents#EXTRA_DATA_XML_LAYOUT

TextView 支持的属性

于 2013-10-15T06:38:50.780 回答
0

通知扩展支持滚动,这就是您看到的地方。否则,不要打扰多行文本视图或类似的东西,所有不适合屏幕的内容都会被截断。

另外,请确保在发布新问题之前搜索 StackOverflow,这个问题与我一年前的问题相同,并且它也有来自 Sony Scrolling 通过 SmartWatch 控件的“官方”答案

于 2013-10-17T11:59:08.790 回答