title: Android Wear automatic layout
body: <p>This is my first try with Android Studio, i have used Eclipse for my previous applications.
  I am create an application for Google Wear and i want to include the function to automatic change the layout depending on square or round watch.</p>
  
  <p>And this is actually the default code but i cant get it to work, maybe someone could point me in the right direction.</p>
  
  <p>It always uses the square layout, i have tried it on actual round watch (Moto 360) and also in the layout windows in Android Studio and even if i pick the Wear Round option it still uses the square layout.</p>
  
  <p>Activity.java</p>
  
  <pre><code>private TextView mTextView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main_wear_activity);
      final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
      stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
          @Override
          public void onLayoutInflated(WatchViewStub stub) {
              mTextView = (TextView) stub.findViewById(R.id.text);
          }
      });
  }
  </code></pre>
  
  <p>rect_main_wear_activity.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  tools:context=".MainWearActivity"
  tools:deviceIds="wear_square"&gt;
  
  &lt;TextView
      android:id="@+id/text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/hello_square" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>round_main_wear_activity.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainWearActivity"
  tools:deviceIds="wear_round"&gt;
  
  &lt;TextView
      android:id="@+id/text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:text="@string/hello_round" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>main_wear_activity.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.wearable.view.WatchViewStub
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/watch_view_stub"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:rectLayout="@layout/rect_main_wear_activity"
  app:roundLayout="@layout/round_main_wear_activity"
  tools:context=".MainWearActivity"
  tools:deviceIds="wear"&gt;
  &lt;/android.support.wearable.view.WatchViewStub&gt;
  </code></pre>