android.netwear-os

Positioning CurvedTextView at bottom of screen [Wear OS]


I want to position a CurvedTextView at the bottom of a ConstraintLayout in Wear OS. But no matter what I do it always positions itself at the top.

My File->New test project's activity_main.xml layout:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.wear.widget.CurvedTextView
        android:id="@+id/clock"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

The app:layout_constraintBottom_toBottomOf="parent" constraint should position it at the bottom of the screen, but this isn't happening and I don't know why.

My activity (in .NET for Android):

using AndroidX.Wear.Widget;

namespace AndroidApp4
{
    [Activity(Label = "@string/app_name", MainLauncher = true)]
    public class MainActivity : Activity
    {
        protected override void OnCreate(Bundle? savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            FindViewById<CurvedTextView>(Resource.Id.clock).Text = "Hello world";
        }
    }
}

Testing on Large Round emulator with API 30. Dependencies on Xamarin.AndroidX.Wear v1.2.0.5 and Xamarin.AndroidX.ConstraintLayout v2.1.4.13.

I'd be very grateful if someone could point out what I'm doing wrong.


Solution

  • Add the tag bellow to rotate the text:

    app:anchorAngleDegrees="180" 
    

    And the tag bellow to change the direcionar of the text:

    app:clockwise="false