I want to implement a running text on the watch, so that a line of text would move from the right to the left.
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.
So my question is: is it possible to dynamically change the attribute "paddingLeft" of the TextView?
<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!"
/>
Maybe something like:
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);
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:
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 :-)
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 ...
I have also thought of sending the text with the spaces in front, like:
- "___Hello_world!"
- "__Hello_world!"
- "_Hello_world!"
but I would like to have a greater granularity of the movement.
So does anybody have any ideas about how to change the "paddingLeft"?