2016-09-15 17 views
0

Android設計庫提供的經典小吃店適用於穿戴項目。 在方形顯示器中,它們看起來很好,但是在圓形中它們沒有。 小吃店的角落由圓形顯示屏裁剪。 有誰知道解決方法? 我不想用烤麪包。用於圓形Android Wear設計的小吃棒

看到圖像:

enter image description here

,我使用的代碼:

Snackbar.make(view, serverMessage, Snackbar.LENGTH_SHORT).show(); 

感謝

回答

0

按照Android blog,有幾種方法可以做到這一點。它們是:

  1. 使用它在使用Shape-Aware Layout guide提到BoxInsertLayout

enter image description here

包括可穿戴式UI庫中的BoxInsetLayout類擴展的FrameLayout,讓你定義一個佈局,無論對於方形和圓形屏幕的作品。此類根據屏幕形狀應用所需的窗口插圖,並可讓您輕鬆對齊屏幕中心或邊緣附近的視圖。

  • WatchViewStub


    的xmlns:機器人= 「http://schemas.android.com/apk/res/android」
    的xmlns:應用=」 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 =「matc h_parent 「
    應用程式:rectLayout = 」@佈局/ rect_activity_main「
    應用程式:roundLayout = 」@佈局/ round_activity_main「
    工具:上下文= 」com.android.example.watchviewstub.MainActivity「
    工具:deviceIds =」穿「>