0

I'm relatively new to Android/smartwatch development, so forgive my nativity. I've been trying to create a simple application which scrolls through values in a list wheel (bit like the time/date picker widgets you see on Android/iPhones), but horizontally as opposed to vertically.

The best fit for my app appears to be the Spinner Wheel widget found here: https://github.com/ai212983/android-spinnerwheel

I can get the provided code & spinner demo working fine on my phone, however when I try and include the widget to my screen layout for the smartwatch, the screen goes blank. Removing the widget again, I can see the rest of my layout elements, so I'm assuming it's the spinner breaking the layout.

I've added the following code to my layout:

 <antistatic.spinnerwheel.WheelHorizontalView
    android:id="@+id/tspinnerWheel"
    android:layout_width="220px"
    android:layout_height="65px"
    android:layout_above="@+id/textTime"
    android:layout_centerHorizontal="true"
    android:paddingTop="5px"
    android:layout_marginBottom="-26px" />

In my app I have the following code in my overridden onResume() method:

    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.zone_screen_test, null);

    final AbstractWheel setpoint = (AbstractWheel) layout.findViewById(R.id.textSetpoint);
    NumericWheelAdapter setpointAdapter = new NumericWheelAdapter(mContext, 5, 35, "%02d");
    setpointAdapter.setItemResource(R.layout.wheel_text_centered);
    setpointAdapter.setItemTextResource(R.id.text);
    setpoint.setViewAdapter(setpointAdapter);

Can anyone help get the above example or suggest an alternative implementation (I'm looking for a basic spinner - I don't need fade animations etc).

Alastair
  • 3
  • 2

1 Answers1

1

The SW2 only supports a subset of standard Android layouts:

The following ViewGroups are supported:

AbsoluteLayout FrameLayout LinearLayout RelativeLayout All XML attributes are supported for the supported ViewGroups.

The following Views are supported:

View ImageView TextView ListView Gallery

See here for full details:

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

The closest thing you will find to what you are looking for is probably the Gallery view.

mldeveloper
  • 2,253
  • 1
  • 13
  • 14
  • Hi @Marlin SONY, thanks for the advice, that helped a lot. I've now implemented my gallery widget. The issue now is that all items are the same shade, I'm looking for centred element to use solid white text & outer elements to be semi-transparent. I've tried using the unselectedAlpha parameter, specifying the state_selected colour in an xml file and adding semi-transparent rectangles covering the outer elements in the parent layout. As I want a large touchable area for the scroll, the gallery has no background, with the parent layout containing the background and surrounding info. Any ideas? – Alastair Jun 19 '14 at 18:16