Note that there are some explanatory texts on larger screens.

plurals
  1. POSony Smartwatch - dynamically change layout (paddingLeft)
    primarykey
    data
    text
    <p>I want to implement a running text on the watch, so that a line of text would move from the right to the left.</p> <p>The best way to do so for me would be to create a TextView with the width of the screen, set the text there with the maximum paddingLeft and then decrement the padding, so that the text (a few words) would move from the right to the left.</p> <p>So my question is: is it possible to dynamically change the attribute "paddingLeft" of the TextView?</p> <pre class="lang-xml prettyprint-override"><code>&lt;TextView android:id="@+id/scrollingText" android:layout_width="@dimen/smart_watch_2_control_width" android:layout_height="wrap_content" android:paddingRight="@dimen/smart_watch_2_control_width" android:text="Hello world!" /&gt; </code></pre> <p>Maybe something like: </p> <pre class="lang-java prettyprint-override"><code>Intent intent = new Intent(Control.Intents.CONTROL_SEND_LAYOUT_INTENT); intent.putExtra(Control.Intents.EXTRA_LAYOUT_REFERENCE, layoutReference); intent.putExtra(Control.Intents.EXTRA_PADDING_LEFT, paddingLeft); controlExtension.sendToHostApp(intent); </code></pre> <p>I am well aware, that there is neither CONTROL_SEND_LAYOUT_INTENT nor EXTRA_PADDING_LEFT in the Control.Intents, as well as of the fact, that something similar can be done with the CONTROL_PROCESS_LAYOUT_INTENT, but there is a note in the documentation:</p> <p><a href="http://developer.sonymobile.com/reference/sony-addon-sdk/com/sonyericsson/extras/liveware/aef/control/Control.Intents#CONTROL_PROCESS_LAYOUT_INTENT" rel="nofollow">Note that the extension must always send a layout covering the full screen according to the display screen size. This means that even though the extension wants to update a portion of the screen a full screen layout must be supplied anyway.</a></p> <p>So in my case I would need to create 220 equal xml-files with the only difference, that paddingLeft is set to 220, 219, 218, etc. and to set the right layout every time? It doesn't sound right for me :-)</p> <p>Another workaround would be to use ImageView instead of the TextView and convert text to the Bitmap every time on the Host and to send the update through "setImage" to the Watch, in fact I have already implemented it this way, but it's not really a high-performance solution ...</p> <p>I have also thought of sending the text with the spaces in front, like:</p> <ol> <li>"___Hello_world!"</li> <li>"__Hello_world!"</li> <li>"_Hello_world!"</li> </ol> <p>but I would like to have a greater granularity of the movement.</p> <p>So does anybody have any ideas about how to change the "paddingLeft"?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload