【发布时间】:2015-04-29 13:23:16
【问题描述】:
我首先想说的是,我知道这里已经有类似的问题了,但没有一个能解决这个问题
我在 Ubuntu 上使用 Round Android Wear Emulator(Android 5.0.1 和 x86)。屏幕显示为圆形,模拟器上的所有其他功能(设置表盘、卡片)都显示为圆形手表。然而,在我的应用程序中,我使用的是 WatchViewStub,尽管我在布局中指定了以下内容,但圆形模拟器正在膨胀方形布局:
app:rectLayout="@layout/rect_activity_setup"
app:roundLayout="@layout/round_activity_setup"
这是我的活动代码:
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setup);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
stub.onApplyWindowInsets(windowInsets);
return windowInsets;
}
});
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
// ...
}
});
}
我还需要做些什么来告诉应用设备是圆形的吗?还是模拟器的BUG?
【问题讨论】:
标签: android android-layout android-emulator wear-os