【发布时间】:2017-09-19 13:10:03
【问题描述】:
我的 Android 应用中有一个可穿戴的抽屉布局。行为是 peek 视图将显示 peek 片段,当用户向上滑动时,peek 片段将淡入内容片段。
我最近尝试将我的 android wear 项目从可穿戴设备 2.0.3 更新到可穿戴设备 2.0.5。很多组件需要从wearable.view改为wear.widget。
更新后,两个片段都会显示抽屉打开或关闭的天气。我尝试手动淡入和淡出这些,但似乎没有办法顺利或轻松地做到这一点。以前的行为是否可能了?我还必须重新安排一些事情才能让它发挥作用。我应该使用不同的格式来获得我以前的行为吗?谢谢!
以前的抽屉布局:
<android.support.wearable.view.drawer.WearableActionDrawer
android:id="@+id/bottom_action_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorPrimary"
app:drawer_content="@+id/nowPlayingFragment">
<!-- Peek View -->
<fragment
android:id="@+id/peekFragment"
android:name="com.turndapage.navmusic.ui.fragment.PeekFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<fragment
android:id="@+id/nowPlayingFragment"
android:name="com.turndapage.navmusic.ui.fragment.NowPlayingFragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.wearable.view.drawer.WearableActionDrawer>
新抽屉布局:
<android.support.wear.widget.drawer.WearableActionDrawerView
android:id="@+id/bottom_action_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorPrimary"
app:drawer_content="@+id/nowPlayingFragment"
app:peekView="@+id/peek_view">
<fragment
android:id="@+id/nowPlayingFragment"
android:name="com.turndapage.navmusic.ui.fragment.NowPlayingFragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- Peek View -->
<fragment
android:id="@+id/peekFragment"
android:name="com.turndapage.navmusic.ui.fragment.PeekFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.wear.widget.drawer.WearableActionDrawerView>
【问题讨论】:
标签: android android-layout android-studio android-fragments wear-os