Android Wear type detection - Round Or Square

前端 未结 4 1741
悲&欢浪女
悲&欢浪女 2020-12-30 06:56

I am curious to know about the wear type, whether it\'s round or square, because on the basis of device type I want to make different views for round and square. From This

4条回答
  •  时光取名叫无心
    2020-12-30 07:20

    If you need to get this information programmatically, you are correct in adding add a listener for setOnApplyWindowInsetsListener(). However, in order to trigger that, you must also call requestApplyInsets().

    In any case, if you only want to know this to switch between two alternative layouts, you can use the WatchViewStub class which does this automatically (docs here).

提交回复
热议问题