DelayedConfirmationView Is Blank On Android Wear
Solution 1:
There is a sample project in sdk called DelayedConfirmation. If you have samples downloaded in your SDK Manager - you can find if here: sdk\samples\android-20\wearable\DelayedConfirmation
Part of main_activity.xml file:
<android.support.wearable.view.DelayedConfirmationView
android:id="@+id/delayed_confirmation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_launcher"
app:circle_color="@color/blue"
app:circle_radius="@dimen/circle_radius"
app:circle_radius_pressed="@dimen/circle_radius_pressed"
app:circle_padding="@dimen/circle_padding"
app:circle_border_width="@dimen/circle_border_normal_width"
app:circle_border_color="@color/white"/>
so the only extra attribute here is:
app:circle_radius_pressed="@dimen/circle_radius_pressed"
in MainActivity.java class there are almost the same lines as you set:
delayedConfirmationView = (DelayedConfirmationView) findViewById(R.id.delayed_confirmation);
delayedConfirmationView.setTotalTimeMs(NUM_SECONDS * 1000);
...
delayedConfirmationView.setListener(this);
But in addition they also invoke .start() method:
delayedConfirmationView.start();
EDIT:
I've tested the DelayedConfirmationView with just FrameLayout and it works just fine, so BoxInsetLayout has nothing to do here.
Even after copy&paste your DelayedConfirmationView xml code everything also works OK, the grayish circle button is displayed on screen. So I was surprised a bit:)
After playing more with this code I've realized that you have wrong xmlns:app line:
xmlns:app="http://schemas.android.com/apk/android.support.wearable.view"
You cannot specify the package of library where the attributes are from (the same way like you cannot use android.support.wearable.R class - You need to use R class from your own package. You need to use:
xmlns:app="http://schemas.android.com/apk/res-auto"
and then everything work fine in your code. This is the reason why after replacing root view with copied BoxInsetLayout code (with proper xmlns) the button the code has started to work:)
Post a Comment for "DelayedConfirmationView Is Blank On Android Wear"